Hey.
Question regarding the call in the main to checkSizesLast function -
The compiler does warns about icompatible pointer types, but I don't succeed to adjust it...
I thought it would be correct to send to checkSizesLast the matrix de-referenced like *matrix but it doesn't work too.
What's the matter here?
Thanks.
Code:
#include <stdio.h>
void checkSizes(char matrix3d[10][20][30])
{
printf ("%lu\n", sizeof(matrix3d));
printf ("%lu\n", sizeof(*matrix3d));
printf ("%lu\n", sizeof(**matrix3d));
printf ("%lu\n", sizeof(***matrix3d));
}
void checkSizesAgain(char (*matrix3d)[20][30])
{
printf ("%lu\n", sizeof(matrix3d));
printf ("%lu\n", sizeof(*matrix3d));
printf ("%lu\n", sizeof(**matrix3d));
printf ("%lu\n", sizeof(***matrix3d));
}
void checkSizesLast(char* matrix3d[20][30])
{
printf ("%lu\n", sizeof(matrix3d));
printf ("%lu\n", sizeof(*matrix3d));
printf ("%lu\n", sizeof(**matrix3d));
printf ("%lu\n", sizeof(***matrix3d));
}
int main()
{
char matrix[10][20][30];
char matrix2[1][20][30];
checkSizes(matrix);
checkSizesAgain(matrix);
checkSizesLast(matrix);
checkSizes(matrix2);
return 0;
}