任务:创建工人数据库。该计划还应该输出工人的信息 名称和统计所有工人的平均工资。当我尝试编译此代码C中的结构问题
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct worker {
char name[10];
int salary;
};
int main (void);
struct worker p1 = {"koko", 3400};
printf ("name=%s,salary=%d,p1,name,p1,salary");
return(0);
}
我得到
./dz2.c:11:9: error: expected declaration specifiers or «...» before string constant
./dz2.c:12:1: error: expected identifier or «(» before «return»
./dz2.c:13:1: error: expected identifier or «(» before «}» token
我会为这个问题的解决表示感谢。
格式化代码很好。代码不只是供电脑阅读 – sehe