wlhuangcn 发表于 2025-3-15 02:30:25

请教:32G12K128结构体编译时提示语法错误

代码如下:
#include "STC32G.h"
#include "stdio.h"
#include "stdarg.h"
#include "string.h"
#include "stdlib.h"

typedef struct
{
char Name;
unsigned int age;
float score;
}student;


void main(void)
{
student stu1 =      //编译报语法错误
    {"zhangsan",
      20,
      92.5
    };
while(1)
}

请教一下:结构体这样使用是不是错误的?

soma 发表于 2025-3-15 21:44:41

while(1)后面没;报错?

21cnsound 发表于 2025-3-15 21:48:40

改成    while(1);

wlhuangcn 发表于 2025-3-16 14:54:24

wnagming 发表于 2025-3-15 20:26
应该用小括号?

感谢您的回复!已解决。

wlhuangcn 发表于 2025-3-16 14:54:47

soma 发表于 2025-3-15 21:44
while(1)后面没;报错?

感谢您的回复!已解决。

wlhuangcn 发表于 2025-3-16 14:55:02

21cnsound 发表于 2025-3-15 21:48
改成    while(1);

感谢您的回复!已解决。
页: [1]
查看完整版本: 请教:32G12K128结构体编译时提示语法错误