#include <stdio.h>
#include <stdlib.h>
struct SIMPLE{
int a;
int b;
int c;
};
int main()
{
struct SIMPLE x;
x.a=4;
x.b=5;
printf("x.a is:%d",x.a);
printf("\n");
printf("x.b is:%d",x.b);
printf("\n");
printf("x.c is:%d",x.c);
printf("\n");
return 0;
}
分析:
结构体没初始化的话,会是任意值。
本文详细解析了结构体变量在C语言中的初始化过程及其基本用法,通过实例展示了如何正确地为结构体成员赋值,并输出其值。
11万+

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



