🎴 Flashcard Mode

C Data Types, Variables & Storage Classes

Card1 / 22
Mastered0
Review0
QuestionClick to flip

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);
}

AnswerClick to flip back
A
5
💡 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.

Change Mode