C Programming - Bitwise Operators - Discussion
Discussion Forum : Bitwise Operators - Find Output of Program (Q.No. 5)
5.
What will be the output of the program?
#include<stdio.h>
int main()
{
unsigned char i = 0x80;
printf("%d\n", i<<1);
return 0;
}
Discussion:
65 comments Page 5 of 7.
Ravikant said:
1 decade ago
Bitwise operators operate on always nos. Means int, so it converted into int.
Subhadeep said:
1 decade ago
What will be the answer if it was printf("%x",i<<1); ?
Shanthi said:
1 decade ago
How would you convert binary into decimal (0000 0001 0000 0000=256) ?
Raj said:
1 decade ago
0x80 is hex representation and its binary equivalent is 1000 0000
Spa said:
1 decade ago
Why everyone taking for char 2bytes. ? can any one explain me.
ANJANI said:
1 decade ago
Thanks a lot. For your nice explanation. I m fully overwhelm.
Shanthu said:
1 decade ago
Char should overflow to become zero instead its becoming 256.
Swathi said:
1 decade ago
How to convert 0x88 int obinary can any one explain please ?
Abhinav said:
1 decade ago
Here x080 can be written as 0000 0000 0101 0000. Is it true?
SRINIVAS said:
1 decade ago
Good.Nice Explanation Without having any doubts.Thank you
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers