C中结构体赋值问题一直没有很清楚,下面发了一个讨论的帖子,自己写了个简单的例程测了下:
#include <stdio.h>
struct test{
int a;
int b;
char c;
float d;
};
int main(){
struct test test_num = {0};
printf("a = %d ,b = %d ,c = %c ,d = %f/n" , test_num.a ,test_num.b ,test_num.c ,test_num.d);
struct test test_num1 = {1};
printf("a = %d ,b = %d ,c = %c ,d = %f/n" , test_num1.a ,test_num1.b ,test_num1.c ,test_num1.d);
}
a = 0 ,b = 0 ,c = ,d = 0.000000
a = 1 ,b = 0 ,c = ,d = 0.000000
参考网页:http://cpp.wgets.com/thread/32174
524



被折叠的 条评论
为什么被折叠?



