What is the output of following program ?

int
main()
{
int x = 5;
printf("%d %d %d\n", x, x << 2, x >> 2);
}

Answer Posted / krishna deep sharma

4,4,1
coz we shift the bit as 5=101 now shift two bit to right as
101>>2=001
now
2<<001=100
noe x=4
printf execute from right to left so ans is 4,4,1

Is This Answer Correct ?    11 Yes 28 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain void pointer?

589


How can I remove the leading spaces from a string?

632


c language interview questions & answer

1457


What are c preprocessors?

676


What does a function declared as pascal do differently?

607






Explain how do you convert strings to numbers in c?

593


What is function prototype in c with example?

576


What is wrong with this declaration?

611


What is the meaning of 2d in c?

611


What is c language in simple words?

593


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

666


What do you mean by dynamic memory allocation in c? What functions are used?

653


What is a static variable in c?

665


What is a rvalue?

747


Can a pointer be volatile in c?

535