Sail E0 Webinar
Question

What will be output of following program?



#include<stdio.h>
#include<string.h>
int main()
{
int a,b,c,d;
char *p = (char*)0;
int *q = (int*q)0;
float *r = (float*)0;
double *s = 0;
a = ( int)(p+1);
b = ( int)(q+1);
c = ( int)(r+1);
d = ( int)(s+1);
printf("%d %d %d %d",a,b,c,d);
return 0;
}


Options:
A .  2 2 2 2
B .  1 2 4 8
C .  1 2 2 4
D .  Compilation error
E .  None of the above
Answer: Option B

Address + 1 = next address




Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers