what will be the output of the following code
output will be
8 8 8 4
size of a pointer to any data type is type independent , size of pointer depends on your machine address bus.
sizeof("clu") here "clu" is treated as array of characters ={'c','l','u','\0'}
so sizeof("clu") is 4 bytes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) { | |
int x=100;char y=3;float z=3.12; | |
int *xp=&x;char *yp=&y;float *zp=&z; | |
printf("%d\t%d\t%d\t%d\t%d\n",sizeof(NULL),sizeof(xp),sizeof(yp),sizeof(zp),sizeof("clu")); | |
return 0; | |
} |
8 8 8 4
size of a pointer to any data type is type independent , size of pointer depends on your machine address bus.
sizeof("clu") here "clu" is treated as array of characters ={'c','l','u','\0'}
so sizeof("clu") is 4 bytes
No comments:
Post a Comment