#include<stdlib.h>
#include<string.h>
#include<stdio.h>
struct Student
{
int ID;
char name[100];
char SSC_Grade[100];
char HSC_Grade[100];
struct Student *next;
}* head;
void insert(int ID, char* name, char* SSC_Grade, char* HSC_Grade)
{
struct Student * student = (struct Student *) malloc(sizeof(struct Student));
student->ID=ID;
strcpy(student->name, name);
strcpy(student->SSC_Grade,SSC_Grade);
strcpy(student->HSC_Grade,HSC_Grade);
student->next = NULL;
if(head==NULL){
head = student;
}
else{
student->next = head;
head = student;
}
}
void display()
{
struct Student * temp = head;
while(temp!=NULL){
printf("ID Number: %d\n", temp->ID);
printf("Name: %s\n", temp->name);
printf("Phone: %s\n", temp->SSC_Grade);
printf("Phone: %s\n", temp->HSC_Grade);
temp = temp->next;
}
}
int main()
{
head = NULL;
insert(2456,"paul","A.","B.");
display();
return 0;
}
Comments
Leave a comment