报错为:表达式必须是只想完整类型的指针

int_heavy 2020-09-15 05:11:24

为什么会报错??
...全文
275 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
qybao 2020-09-18
  • 打赏
  • 举报
回复
void input(struct sudent stu[]) 结构体名字错误,正确是 student
qiaodamo 2020-09-18
  • 打赏
  • 举报
回复
拼写错误,函数参数里的 sudent ---> student ......
千梦一生 2020-09-18
  • 打赏
  • 举报
回复
换一个结构体名字试试
int_heavy 2020-09-17
  • 打赏
  • 举报
回复
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string.h> #define N 3 struct student { int num; char name[20]; double score[3]; }; int main(void) { } void input(struct sudent stu[]) { int i; printf("请轮流输入每个学生的学号,姓名,三科成绩\n"); for (i = 0; i < N; i++) { scanf("%d %s %lf %lf %lf", &stu[i].num, stu[i].name, &stu[i].score[0], &stu[i].score[1], &stu[i].score[2]); } } 这就是全部代码了,main函数还没写
自信男孩 2020-09-16
  • 打赏
  • 举报
回复
这样看没什么问题?能否把错误和所有的代码都贴出来呢
赵4老师 2020-09-16
  • 打赏
  • 举报
回复
#pragma warning(disable:4996)
#include <stdio.h>

struct student {
    int num;
    char name[20];
    double score[3];
};
const int N=3;
struct student stus[N];

void input(struct student stu[]) {
    int i;
    for (i=0;i<N;i++) {
        printf("input %d (num name sc1 sc2 sc3):",i+1);
        scanf("%d%s%lf%lf%lf",&stu[i].num,stu[i].name,&stu[i].score[0],&stu[i].score[1],&stu[i].score[2]);
    }
}

void print(struct student stu[]) {
    int i;
    for (i=0;i<N;i++) {
        printf("%d ",i+1);
        printf("%d %s %lg %lg %lg\n", stu[i].num,stu[i].name, stu[i].score[0], stu[i].score[1], stu[i].score[2]);
    }
}

int main() {
    input(stus);
    print(stus);
    return 0;
}
// input 1 (num name sc1 sc2 sc3):11 a 81 82 83
// input 2 (num name sc1 sc2 sc3):22 b 91 92 93
// input 3 (num name sc1 sc2 sc3):33 c 71 72 73
// 1 11 a 81 82 83
// 2 22 b 91 92 93
// 3 33 c 71 72 73
int_heavy 2020-09-15
  • 打赏
  • 举报
回复
struct student { int num; char name[20]; double score[3]; }; 结构体是这样定义的
自信男孩 2020-09-15
  • 打赏
  • 举报
回复
需要看一下你的结构体定义是什么样的~
硬件拾遗 2020-09-15
  • 打赏
  • 举报
回复
看一下你的结构体定义

70,023

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧