Monday 11 March 2013

sizeof(signed) and sizeof(unsigned)


    #include<stdio.h>
    int main()
{
    int a= sizeof(signed) +sizeof(unsigned);
    int b=sizeof(const)+sizeof(volatile);
    printf("%d",a+++b);
    return 0;
}
Output: 8
Explanation: Default data type of signed, unsigned, const and volatile is int. So, a = 4 and b =4
Now, a+++b
= a++ + b
= 4 + 4  //due to post increment operator.
=8


Blog Author: Vijay Kumar

Go to: Java Aptitude

No comments:

Post a Comment