السلام عليكم
لدي الكود التالي
#include <stdio.h>
#include <stdlib.h>
/*
THIS PROGRAM TO ADD NODE AT THE FIRST ONLY AND AT FINAL WILL PRINT ALL THE DATA
*/
typedef struct node {
int day;
float av;
struct node *next;}student;
int main()
{student *head ,*n ,*k;
head=(student*)malloc(sizeof(student));
printf("give me day & av");
scanf(" %d%f",head->day,head->av);
printf("do u want to enter new value :yes press yes ,,other press any key");
char x=getchar();
while(x=='y')//ربما نقوم بدور مرادف من خلال استخدام اقترانات النصية
{printf("give me day &av");
n=(student*)malloc(sizeof(student ));
scanf(" %d%f",n->day,n->av);
n->next=head;
head=n;
//قم بالتالي:اضف نود جديدة واربطها لتسبق ما قبلها ثم اظهر جملة الطباعة
printf("do u want to enter new value :yes press yes ,,other press any key");
char x=getchar();
}
//ما تبقى من حالات حين يرفض ادخال نود جديدة نطلب منه طباعة كل النود الموجود
k=head;
while(k!=NULL)
{
printf("%d%f",k->day,k->av);
k=k->next;
}
return 0;
}لا يظهر فيه اي اخطاء لكن حين التنفيذ لايتم تنفيذه .. علما بان وظيفة الكود مذكورة فيه..
الصورة ادناه للتوضيح


