首页  >  问答  >  正文

求c语言大神,指针指向链表的数据如何进行运算和比较?这样写语法是不是错误呢?

主要问题一直出现在这两行
warning C4047: '==' : 'char [10]' differs in levels of indirection from 'const int '
error C2059: syntax error : 'type'

虽然看得懂英语的意思,但是改来改去还是不行
已经在头文件里声明了结构体了
int count = 0;
typedef struct stu{
char num[10];
char name[10];
char sex[3];
int chinese;
int math;
int english;
float sum;
float avg;

struct stu *next;

}stu_link;

stu_link *head;

初学者 第一次因为作业要求使用链表 希望各位大神帮忙!


巴扎黑巴扎黑2875 天前731

全部回复(1)我来回复

  • 面对疾风吧

    面对疾风吧2016-11-08 15:07:24

    上课请认真听课。
    C语言中无法重载运算符。
    请自定义compare函数进行对比。
    ps:字符串使用strcmp

    回复
    0
  • 取消回复