main()
{
int x=5;
printf("%d %d %d\n",x,x<<2,x>>2);
}
Answer Posted / daniel
Indeed the correct answer is 5, 20, 1.
Explanation:
* the value of x is 5 so it will print out 5
* the value of x << 2, x shifted to left 2 times means x multiplied by 2 for 2 times, i.e. 5 * 2 * 2 = 20
* the value of x >> 2, x shifted to right 2 times so the result will be 5 / 2 / 2 = 5 / 4 = 1 (x is an int).
| Is This Answer Correct ? | 85 Yes | 2 No |
Post New Answer View All Answers
What is an example of structure?
Is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?
What is difference between array and pointer in c?
Explain the bubble sort algorithm.
What is the correct code to have following output in c using nested for loop?
What is pragma c?
What is the translation phases used in c language?
Is c call by value?
How to write a program for machine which is connected with server for that server automatically wants to catch the time for user of that machine?
write a program to create a sparse matrix using dynamic memory allocation.
What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?
Explain the advantages and disadvantages of macros.
How can I find out if there are characters available for reading?
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555
Between macros and functions,which is better to use and why?