Q:

Bitwise shift for unsigned long long type

In a c program. I am trying to use the left shift operator on uint64_t variable.
E.g. 
  // with shift of 24 bits
  uint64_t x = 0;
  x = (((uint64_t)76) << (24));
  Output is: x = 1275068416
  ---------------------------------------------
  // with shift of 32 bits
  uint64_t x = 0;
  x = (((uint64_t)76) << (32));
  Output is: x = 0

If I perform left shift till 24 bits then it works fine, but at 32 bits it outputs 0. Whereas what I think is as the size of uint64_t i.e. unsigned long long is 64 bits. So shouldn't it work till the 64 bit shift ?

A:

You're using the wrong format specifier to print the output.  The %d format specifier expects an int, which apparently is 32-bit on your system.  So passing a 64-bit value (and an unsigned one at that) leads to undefined behavior.
You should use the PRIu64 macro to get the correct format specifier for an unsigned 64-bit value.
printf("%"PRIu64"\n", x);

