Code:
#include <stdio.h>
main()
{
----------int i;
----------scanf("%d", &i);
----------printf("%d%d", i&~0x33, (i>>2)&033);
}
How does this work. For example, if 66 is entered, it writes '6416', if I miss out the ~ symbol on the first parameter it writes '216', if i miss out on ~ on the latter, it writes 640. Can anybode explain what does this actually do. I'm asking this because on my exam, we'll have to deal with these problems without using a compiler, meaning, trying to figure out on one's own what will the program return.
Code:
void f2(unsigned char broj)
{
broj=(((broj&240)>>4) + ((broj&15)<<4));
printf("0x%x", broj);
}
same thing, I do know that if 212 is entered into the functon, it returns 0x4D, again why and how?
thank you