Here is some code.
long long bitmap2 = 1; printf("%d\n", bitmap2 & 1); The output is 0, but I am expecting 1. How can I fix this? (I have tried 1LL instead of 1 and uint64_t instead of long long; both gave the same answer of 0.)
What you're currently seeing is undefined behaviour; you need to ensure that the format specifier and the argument match. So use one of the following:
printf("%lld\n", bitmap2 & 1); printf("%d\n", (int)(bitmap2 & 1)); See e.g. http://en.cppreference.com/w/c/io/fprintf for complete documentation for printf.
However, most compilers should warn you if there's a mismatch between the printf format string and the types of the arguments that you supply. For example, if I compile your code in GCC with the -Wall flag, I get the following:
warning: format '%d' expects type 'int', but argument 2 has type 'long long int'