[ create a new paste ] login | about

Link: http://codepad.org/C7ytCw8J    [ raw code | output | fork ]

C, pasted on Nov 22:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>

#define a 10
#define b 5

int foo[a][b];

int *pointerToElement(i, j)
{
	return *foo + i * b + j;
}

int main()
{
	foo[10][5] = 7;
	printf("%d", *pointerToElement(10, 5));
	return 0;
}


Output:
1
7


Create a new paste based on this one


Comments: