Newtopython
诗岑
采纳率78%
2020-02-18 15:41

一个无法解析的外部命令

已采纳

project产生如下报错:
1.一个无法解析的外部命令
2.无法解析的外部符号 _main,该符号在函数 "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) 中被引用

#include<stdio.h>
#include<stdlib.h>
struct student {
    char name[20];
    int score;
    struct student* pnext;//指向下一个学生的指针
};
int count=0;
struct student* create() {
    struct student *phead = NULL;
    struct student* pend, * pnew;
    pend = (struct student*)malloc(sizeof(struct student));
    pnew = (struct student*)malloc(sizeof(struct student));
    scanf_s("%s", &pnew->name, 20);
    scanf_s("%d", &pnew->score);
    while (pnew->score != 0) {
        count++;
        if (count == 1) {
            pend = pnew;
            phead = pnew;
        }
        else {
            pnew->pnext = NULL;
            pend->pnext = pnew;
            pend = pnew;
        }
        pnew = (struct student*)malloc(sizeof(struct student));
        scanf_s("%s", &pnew->name, 20);
        scanf_s("%d", &pnew->score);

    }
    free(pnew);
    return phead;


}
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

相关推荐