-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab7.c
54 lines (38 loc) · 1.06 KB
/
lab7.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <stdio.h>
#include <stdlib.h>
struct student{
int number;
char name[40];
char surname[40];
float finalGrade, midtermGrade;
struct student *next;
};
typedef struct student node;
node *createList(){
int i;
node *ptr = (node*)malloc(5*sizeof(node));
printf("Ogrencilerin bilgilerini giriniz:");
for(i=0; i<5;i++){
/* if(i == 0){
head = (node*)malloc(sizeof(node));
ptr = head;
}
else{
ptr -> next = (node*)malloc(sizeof(node));
ptr = ptr -> next;
}
*/
printf("Enter %d. student name - surname : %s - %s \n", i+1, (ptr+i)->name, (ptr+i)->surname);
scanf("%s%s", (ptr+i)->name,(ptr+i)->surname);
printf("Enter %d. student number: %d \n", i+1, (ptr+i)->number);
scanf("%d", (ptr+i)->number);
printf("Enter %d. student midtermGrade - finalGrade : %f - %f \n", i+1,(ptr+i)->midtermGrade,(ptr+i)->finalGrade);
scanf("%f%f",(ptr+i)->midtermGrade,(ptr+i)->finalGrade);
}
/*ptr -> next = NULL;*/
}
int main(){
int enter;
printf("Ogrenci dizisini oluturunuz:\n");
createList();
}