Please check this line below, it omits the first dimension, how would the array like this be ???
PHP Code:
int myarray[][3][4]
Please check this line below, it omits the first dimension, how would the array like this be ???
PHP Code:
int myarray[][3][4]
Never end on learning~
The 3d array gives me a headache, I would have to look that one up, but you can leave the first element in a 2d array if you initialize the array like so.
Code:#include<stdio.h> int main() { int array[][3] = { {1,2,3}, {4,5,6}, {7,8,9}, {10,11,12} }; int i; int ii; for(i=0;i< sizeof(array) / sizeof(array[0]) ; i++) { for (ii =0; ii < sizeof(array[0]) / sizeof(array[0][0]); ++ii ) { printf("%d ",array[i][ii]); } printf("\n"); } return 0; }
Well you can omit the first dimension when initialising an array as TK has shown.
You can also omit the first dimension when declaring an array as an extern.
extern int myarray[][3][4];
And you can also omit the first dimension when declaring a function prototype.
void foo ( int myarray[][3][4] );
When you declare it with the 'extern' keyword, does this mean that you have to define it in another file?
If so, than when you define it you have to initialize it in the definiton?