C Programming - Input / Output - Discussion
Discussion Forum : Input / Output - Find Output of Program (Q.No. 6)
6.
What will be the output of the program ?
#include<stdio.h>
int main()
{
printf("%c\n", ~('C'*-1));
return 0;
}
Discussion:
32 comments Page 4 of 4.
Nik said:
1 decade ago
How come bitwise not (~) to -67 is 66 , why not 67 itself?
Hariraj said:
2 decades ago
ASCII Value of 'C' is 67.
67*-1=-67
applying bitwise not(~) to -67 will result in 66, which is the ASCII value of 'B'.
67*-1=-67
applying bitwise not(~) to -67 will result in 66, which is the ASCII value of 'B'.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers