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 ?
x?%dis working forints. Use "%llu"uint64_tyou needprintf("%"PRIu64"\n", x);.