69,371
社区成员
发帖
与我相关
我的任务
分享
typedef struct{
char mark;
int score;
int id;
}test_t;
struct test test1 = {1,’B’,80.5}; //整体初始化。√
struct test test1; //结构体变量的声明
test1 = {1,’B’,80.5}; //整体赋初值。×
typedef struct{
int score;
int id;
}test_t;
test_t test1 = {90, 200902};
test_t test2;
test2 = test1;
test_t test1 = {90, 200902}; //定义(声明+初始化)
test_t test2; //声明
test2 = test1; //相同类型的结构体变量直接赋值操作,也是对test2的赋初值操作
#include <stdio.h>
typedef struct{
int score;
int id;
}test_t;
int main(void)
{
test_t test1 = {90, 200902};
test_t test2;
test2 = test1;
}