摘要:
1 #include <stdio.h> 2 3 int&foo(int a) 4 { 5 static int t; 6 t = a; 7 return t; 8 } 9 10 void main(void)11 {12 if (foo(1) == foo(2))13 {14 printf("right!\n");15 }16 return;17 } 最后结果为:right! 下面为执行过程中的汇编代码:16: if (foo(1) == foo(2))00401078 push 10040107A c... 阅读全文
摘要:
1 #include <stdio.h> 2 3 struct MyStruct 4 { 5 int a; 6 MyStruct(); 7 } 8 9 MyStruct::MyStruct()10 {11 a =10;12 }13 14 void main(void)15 {16 MyStruct test;17 printf("%d\n", test.a);18 } 最后结果是:10 另外,将上述代码修改如下: 1 #include <stdio.h> 2 3 struct MyStruct 4 { 5 int a:4; // 注意!!! 6 M. 阅读全文