C output type question

Q.  What would be the output of the following program? (C programming)

#include”stdio.h”
main()
{
int a, b=5;
a=b+NULL;
printf(“%d”, a);
}

- Published on 25 Jun 15

a. 6
b. 5
c. 5 5
d. None

ANSWER: 5
 
The value for b=5
a=b+null (null value is always 0)
a=5+0
a=5
Hence, the output is 5.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)