Nested Sizeof Operator : C Interview Questions
- Nested Sizeof Operator is Allowed in C Programming Language.
- Sizeof Operator will gives us size of variable passed to the function.
- Innermost Sizeof operator will evaluate size of Variable “num” i.e 2 bytes
- Outer Sizeof will evaluate Size of constant “2″ .i.e 2 bytes
What will be the output of Following Program ?
main() { int num = 100; clrscr(); printf("%d", sizeof(sizeof(num))); }
Output :
2