I made this small program just to get an idea of how to do logical shifting right in C.
#include <stdio.h>
int main (void)
{
int n=-2,t;
t = (int)((unsigned int)n >> 1);
printf("%d\n",t);
return 0;
}
However, it outputs
2147283747.
Am I missing something here? Shouldn't the answer be 7?