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 ?    84 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is memcpy() function?

617


What is switch in c?

642


Explain the difference between #include "..." And #include <...> In c?

622


What are the application of void data type in c?

690


What is the use of parallelize in spark?

570






What is getch c?

847


Is fortran still used in 2018?

588


What are the advantages and disadvantages of c language?

556


Explain how can I open a file so that other programs can update it at the same time?

586


What is the return type of sizeof?

586


What is #include called?

565


What is omp_num_threads?

575


What is hash table in c?

564


Describe the header file and its usage in c programming?

616


How do you sort filenames in a directory?

707