C Programming Code Examples C > Pointers Code Examples Declare a pointer to an array that has 10 ints in each row: allocate memory to hold a 4 x 10 array Declare a pointer to an array that has 10 ints in each row: allocate memory to hold a 4 x 10 array #include <stdio.h> #include <stdlib.h> int pwr(int a, int b); int main(void) { int (*p)[10]; register int x, y; p = malloc(40 * sizeof(int)); if(!p) { printf("Memory request failed.\n"); exit(1); } for(y = 1; y < 11; y++) for(x = 1; x < 5; x++) p[ x - 1][y - 1] = pwr(y, x); for(y = 1; y < 11; y++) { for(x = 1; x < 5; x++) printf("%10d ", p[x-1][y-1]); printf("\n"); } return 0; } /* Raise an integer to the specified power. */ pwr(int a, int b) { register int t=1; for(; b; b--) t = t*a; return t; }