I'm having some difficulties understanding two dimensional arrays in C.
Let's look at this example:
#include <stdio.h>
void foo(int arr[2][3]) {
printf("%d", *arr);
}
int main() {
int arr[2][3] = { {10, 20, 30},
{40, 50, 60}
};
foo(arr);
return 0;
}
I have a few questions:
- What is the value of arr? Is it the address of arr[0][0]?
- If arr is the address of arr[0][0], then why the line:
printf("%d", *arr);
doesn't print the value 10? - Each time I run it, I get a strange number. what is the meaning of this number?
Thanks :)