标签:
// 关于临时变量出其作用域就释放的例子 #include <stdio.h> // 临时变量s出函数作用域就销毁了,该空间里就是随机值 unsigned short *sum(unsigned char a, unsigned char b) { unsigned short s = 0; s = a + b; return &s; } int main() { unsigned short *p = NULL; unsigned char a = 1, b = 2; p = sum(a, b); printf("%u+%u", a, b); printf("=%u\n", *p); return 0; }
标签:
原文地址:http://blog.csdn.net/zhaoyaqian552/article/details/45584855