Check this C program:
#include <stdio.h>
int main(void) {
// your code goes here
char **p = NULL;
printf("%d,%d\n", sizeof(*p), sizeof(**p));
return 0;
}
Executing the above code, the result is:
8,1
Although p is NULL, it doesn't cause program crash in sizeof(*p) and sizeof(**p). How to understand this behavior? Is it assured in c spec?
sizeof(*p)is justsizeof (char *)andsizeof(**p)is justsizeof(char)