I have the following code:
#include <stdio.h>
int main() {
long long int x = 4294967296;
long long int y = 2^32; // 4294967296
printf("%lld \n", x);
printf("%lld \n", y);
}
It outputs:
4294967296
34
This is a contrived example but how can I force an arithmetic expression to a wider type? I tried something like
(2LL)^(32LL)
but does not work. I'm compiling with gcc on 64-bit Ubuntu.
.
// EDIT
Obviously I'm a noob and did not realize ^ is not the exponential operator but bitwise XOR... I'll now shamefully go back to learning C