R
Rajesh S R
Consider the following code:
int main()
{
struct name
{
long a;
int b;
long c;
}s={3,4,5},*p;
p=&s;
printf("%d",*(int *)((char *)p+(unsigned int)&(((struct name*)0)-
return 0;
}
Is the expression (unsigned int)&(((struct name*)0)->b) valid as per
C99?
That is,
Can an operand of postfix operator -> be a null pointer?
Please clarify.
Thanks in advance for the reply.
int main()
{
struct name
{
long a;
int b;
long c;
}s={3,4,5},*p;
p=&s;
printf("%d",*(int *)((char *)p+(unsigned int)&(((struct name*)0)-
b)));
return 0;
}
Is the expression (unsigned int)&(((struct name*)0)->b) valid as per
C99?
That is,
Can an operand of postfix operator -> be a null pointer?
Please clarify.
Thanks in advance for the reply.