#include <stdio.h>
unsigned char fun(int);
int main()
{
unsigned char a;
a =fun(1);
printf("2nd returned:%d\n",a);
return 0;
}
unsigned char fun(int s)
{
unsigned char t;
switch(s)
{
case 1:printf("1st the value is:%d\n",t); return t;
case 2:printf("???\n"); return t;
}
return 0;
}
|
在我的XCode 3.0 (MAC 10.5.8)中新建一个"Standard Tool" of "Command Line Utility"工程, 将如上文件内容替换掉main.c,运行程序看到的结果为:
[Session started at 2009-11-25 16:34:56 +0800.]
1st the value is:1
2nd returned:0
The Debugger has exited with status 0.
|
但是用gcc单独编译,打印的结果是:
1st the value is:143
2nd returned:143
|
t自然是一个随机值.
暂时还没有搞明白是怎么回事.
阅读(2193) | 评论(1) | 转发(0) |