I need help on the questions below, thank you in advance! QUESTIONS: 1. Define a
ID: 3540465 • Letter: I
Question
I need help on the questions below, thank you in advance!
QUESTIONS:
1. Define a user-defined type named STUDENT containing the following fields:
id %u2013 an integer
name %u2013 an array of 80 characters for c string
major %u2013 an array of 4 characters for the major code
Write a function named printStudents that receives an array of students and an integer for the number of students and print the students to the stdout one student per line.
In the main function, declare and initialize an array of 5 students with data of your choice. Call the printStudents function and pass the array and the number.
2. Add a link field to the STUDENT type in #4. Write a function named findStudent using the following prototype.
STUDENT *findStudent (STUDENT *list, int ID);
The parameter list is the pointer to the first student in a linked list. The function will find the student with the ID in the list and return the pointer to that student.
Define a user-defined type named STUDENT containing the following fields: id %u2013 an integer name %u2013 an array of 80 characters for c string major %u2013 an array of 4 characters for the major code Write a function named printStudents that receives an array of students and an integer for the number of students and print the students to the stdout one student per line. In the main function, declare and initialize an array of 5 students with data of your choice. Call the printStudents function and pass the array and the number. Add a link field to the STUDENT type in #4. Write a function named findStudent using the following prototype. STUDENT *findStudent (STUDENT *list, int ID); The parameter list is the pointer to the first student in a linked list. The function will find the student with the ID in the list and return the pointer to that student.Explanation / Answer
I MADE A SIMILAR PROBLEM #include /* User defined types */ enum deptcode {sales,personnel,packing,engineering}; typedef enum deptcode DEPT; struct person { int age, salary; DEPT department; char name[12]; char address[6][20]; }; typedef struct person EMPLOYEE; void read_line(char Str[]) { int i = 0; char next; while ((next=getchar())!=' ') { Str[i] = next; i++; } Str[i] = 0; /* Set the null char at the end */ } void print_employee(EMPLOYEE Emp) { int i; printf(" %d %d %d ",Emp.age,Emp.salary,Emp.department); printf("%s ",Emp.name); for (i=0;iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.