我是C新手,編寫一個簡單的程序來顯示數據的字節表示。當我編譯時,命令提示符屏幕閃爍1/2秒並消失。用簡單的話來說,輸出不會顯示出來。以下是我的代碼:C輸出不顯示(新手到C)
#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]);
}
}
如果您在Windows上:http://stackoverflow.com/questions/2529617/how-to-stop-c-console-application-from-exiting-immediately – Mysticial
這也有幫助。如果我沒有錯,廣告你就是那個人。 – jmishra
是的,你是對的。 :) – Mysticial