Pages

Monday, April 23, 2012

size zero ..

*Type - Finding and observation

sizeof operator, is a common way to know about the types in C/C++. Ever thought of seeing something which is making sizeof return 0. Yes, I  just discovered a type which returns 0 for its variables.

What did this code give in your machine ..
char ch[0];
printf("%d",sizeof(ch));

doesnt matter much though ;)

It printed 0 in mine-  gcc/ Ubuntu 11.04/ 32 bit machine ..

No comments:

Post a Comment