I have a simple question. The code is really short so I just post it here
#include <stdio.h>
int main(int argc, const char * argv[])
{
long int p;
printf("FYI: address of first local varaible of main() on the function stack:%p\n",&p);
printf("Enter start address <hex notation> of dump:");
scanf("%lx",&p);
char * q;
q = (char*)p;
printf("%x\n",*q);
return 0;
}
The result of last printf, for example is ffffffc8. What if I only want to keep the last two: c8. How can I do that? I tried:
printf("%2x",*q);
and
printf("%x",*q % 256);
But neither works. Can some one help? Thanks!