main()
{
int x=5;
printf("%d %d %d\n",x,x<<2,x>>2);
}
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / anand h i
in printf functiton evaluation of variables start from
right to left so first it evaluates
x>>2
101 after right shift of 2 it will be 001=1
next it will evaluate
x<<2
1 after left shift of 2 it will be 100=4
at the last x=4
so answer is 4 4 1
| Is This Answer Correct ? | 3 Yes | 13 No |
oh oh , sorry , i didnt see the value of x is 5....
4 4 1
than k u
| Is This Answer Correct ? | 1 Yes | 11 No |
how can i get the string which is having two spaces at the end.suppose the string is "Hello World ".Now at the end i have two spaces.i need to print with that spaces .
How can I sort more data than will fit in memory?
What is an array in c?
What is a memory leak in structures? How can we rectify that?
What is a memory leak? How to avoid it?
c language interview questions & answer
in any language the sound structure of that language depends on its a) character set, input/output function, its control structures b) character set, library functions, input/output functions its control structures c) character set, library functions, control sturctures d) character set, operators, its control structures
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
Explain how can you determine the size of an allocated portion of memory?
using for loop sum 2 number of any 4 digit number in c language
How many loops are there in c?
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array