I am new to C and writing a simple program to display the byte representation of data. When I compile, the Command Prompt screen flashes for 1/2 a second and disappears. In simpler words, the output doesn't show up. Following is my code:
#include <stdio.h>
typdef unsigned char* pointer;
void show_int(int);
void show_bytes(pointer, int);
int main()
{
show_int(100);
}
void show_int(int x)
{
show_bytes((ponter) &x, sizeof(int));
}
void show_bytes(pointer start, int len)
{
int i;
for(i=0;i<len;i++)
{
printf("0x%p\t0x%.2x\n", start + i, start[i]);
}
}