[英]c language sort by value in structure
I can't understand what wrong here. 我不明白这里出了什么问题。 I run debug and can't find the problem it's supposed to work. 我运行调试,找不到应该起作用的问题。 the problem is that if I insert few students and then chose (3 option) to sort it by nakaz, it prints 0 instead of the actual value number. 问题是,如果我插入几个学生,然后选择(3个选项)按nakaz对其进行排序,它将打印0而不是实际值数字。 but I can see that it all good in the F7 thank you very much in c language 但是我可以看到在F7中一切都很好,非常感谢C语言
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct student* ps; //struct student pointer
typedef struct student student;
You've got the wrong output type on the points printf. 您在printf点上的输出类型错误。 You have it set to "%lf"
when it should be "%d"
based on the expected integer type of the variable: 根据变量的预期整数类型,应将其设置为"%lf"
"%d"
时将其设置为"%lf"
:
void printAllStudents(ps head){
while (head != NULL){
printf("The student %s points is %d \n", head->name, head->nakaz);
head = head->next;//printing all dogs
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.