Multiple choice

What will be the output of the following C code? void main() { int t; char *pc=(char *)0; float *pf=(float *)0; t=(int)(pc+1) + (int)(pf+1); printf(%d,t); }

  1. 3

  2. 5

  3. 7

  4. 8

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The initial address of char and float data types is 0. So, the values of (int)(pc+1) and (int)(pf+1) will be 1 and 4, respectively. Hence, the output of the code will be 5.