C - Operators - Discussion

You Are Here :: Home > C > Operators - Discussion

 



Q.

Find the output :

main()
{
printf("%x",-1<<4);
}

A. ff00 B. fff0
C. ffff D. f000

Answer: Option B
Explaination:

 


-1 is internally represented as all 1 s. When left shifted four times the least significant 4 bits are filled with 0 s.The %x format specifier specifies that the integer value be printed as a hexadecimal value



Discussion

Your Comments Goes here...
NameDiscussion