https://gatecse.in/data_types_operators_in_c/ Q7.
|
#include <stdio.h>
int main()
{
char *p = "Hello World";
char q[] = "Hello World";
printf("%zd %zd", sizeof p, sizeof *p);
printf("\n");
printf("%zd %zd", sizeof q, sizeof *q);
return 0;
}
|
sizeof p- size of pointer which is compiler dependent
sizeof q-size of the char array
Is it correct? What will sizeof *p and sizeof *q give?
I am getting the output as
4 1
12 1