Welcome, %1$s. Please login or register.

November 22, 2017, 04:35:54 PM
: 1
: Guess the output: Right Shift operator.  ( 1772 )
« : October 19, 2007, 02:30:03 PM From Poonam»



Guess the output: Right Shift operator.


#include <stdio.h>
int main()
{
               /* Assume the sizeof int to be 4 bytes */
        int val = 1;
        int count = 32;
 
        val = val >> count;
        printf("%d\n",val);
 
        return 0;
}

 
 
Can you tell me what the value of val going to be?

 

 
Liked It? Share it!

              


« #1 : October 22, 2007, 10:06:10 PM From spazinvader»

Is it 1 as the answer?
If there is a 32 bit shift for a 32 bit number,the number will be same na?
« #2 : October 26, 2007, 11:28:39 PM From Poonam»

Spazinvader, try executing it. You will be surprised to know that it isn't 0.
« #3 : November 12, 2007, 07:24:02 PM From Rahul»

100000(binary)
after operation
010000

ans is 16
: 1
« previous next »

 

Best RatedList All>>



Latest
Random



SMF 2.0.10 | SMF © 2015, Simple Machines | Contact Webmaster | OnlineFunDb.com © 2009/10 | Legal Disclaimer