Hello everyone,

I was searching for a way to get absolute value efficiently using bit level hacks, n found it's int equivalent, but i wanted it on long long so changed int to long long,

Code:#include <stdio.h> #define CHAR_BIT 8 unsigned long long getAbs(long long n) { long long int const mask = n >> (sizeof(long long) * CHAR_BIT - 1); return ((n + mask) ^ mask); } int main() { long long n = -6; printf("Absoute value of %ll is %llu", n, getAbs(n)); //why the value of n is not printed.... getchar(); return 0; }