岚殿 2021-03-14 16:10 采纳率: 0%
浏览 934

Clion 调试的时候,printf没有输出内容,但是普通运行可以输出内容

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define LEN sizeof(struct Student)

struct Student{
    char name[10];
    int number;
    struct Student *next;
};

struct Student * InitList();
void CreatList(struct Student *head);
void PrintList(struct Student *head);
struct Student GetListElm(struct Student *head,int i);

int main(void){
    struct Student *head,student;
    head=InitList();
    CreatList(head);
    PrintList(head);
    student=GetListElm(head,2);
    printf("%s",student.name);
    return 0;
}

struct Student *InitList() {
    struct Student *head=NULL;
    head=(struct Student*)malloc(LEN);
    head->next=NULL;
    return head;
}

void CreatList(struct Student *head) {
    struct Student *pre=NULL,*cur=NULL;
    int number,n=0;
    char name[10];
    pre=head;
    while (1){
        printf("请输入学号(-1结束输入):\n");
        scanf("%d",&number);
        if (number==-1){
            break;
        }
        getchar();
        printf("请输入姓名:");
        gets(name);
        cur=(struct Student*)malloc(LEN);
        cur->number=number;
        strcpy(cur->name,name);
        pre->next=cur;
        pre=cur;
        n++;
    }
    head->number=n;
    cur->next=NULL;
}

void PrintList(struct Student *head) {
    struct Student *cur=head->next;
    printf("共有%d条数据\n",head->number);
    while (cur!=NULL){
        printf("姓名:%s\t",cur->name);
        printf("学号:%d\n",cur->number);
        cur=cur->next;
    }
}

struct Student GetListElm(struct Student *head, int i) {
    struct Student *cur=head->next;
    int length=head->number,j;
    if (i>length){
        printf("您所查找的编号超出了链表范围");
        system("pause");
        exit(0);
    }
    for(j=0;j<i;j++){
        cur=cur->next;
    }
    return *cur;
}

下面是软件的提示,我在百度上寻找不到答案,谢谢大佬们

Error during pretty printers setup: Undefined info command: "pretty-printer".  Try "help info".

Some features and performance optimizations will not be available.

D:\practice\ManageSystem\cmake-build-debug\ManageSystem.exe
  • 写回答

2条回答 默认 最新

  • Peter(阿斯拉达) 博客专家认证 2021-03-14 20:57
    关注

    可以看看项目设置或全局设置里关于pretty-printer的, 设置输出窗口为`控制台`,貌似clion的输出捕抓失败。

    评论

报告相同问题?

悬赏问题

  • ¥200 csgo2的viewmatrix值是否还有别的获取方式
  • ¥15 Stable Diffusion,用Ebsynth utility在视频选帧图重绘,第一步报错,蒙版和帧图没法生成,怎么处理啊
  • ¥15 请把下列每一行代码完整地读懂并注释出来
  • ¥15 pycharm运行main文件,显示没有conda环境
  • ¥15 寻找公式识别开发,自动识别整页文档、图像公式的软件
  • ¥15 为什么eclipse不能再下载了?
  • ¥15 编辑cmake lists 明明写了project项目名,但是还是报错怎么回事
  • ¥15 关于#计算机视觉#的问题:求一份高质量桥梁多病害数据集
  • ¥15 特定网页无法访问,已排除网页问题
  • ¥50 如何将脑的图像投影到颅骨上