I saw this question about the the result of sizeof()
and i didn't understand the output of this function.
#include <stdio.h>
void checkSizes(char matrix3d[10][20][30])
{
printf ("%lu\t", sizeof(matrix3d));
printf ("%lu\t", sizeof(*matrix3d));
printf ("%lu\t", sizeof(**matrix3d));
printf ("%lu\t", sizeof(***matrix3d));
}
int main()
{
char matrix[10][20][30];
checkSizes(matrix);
}
as i was assuming , when a function get an array to work with , it's getting a pointer to the array, so when i'll print the first line of
printf ("%lu\n", sizeof(matrix3d));
the output will be 8.
BUT isn't the next printf will get me to diffrent pointer to pointer that his size will be also 8 ?
so i thouth this will lead to
8 8 8 1
the real output is
8 600 30 1