Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include <stdio.h> typedef struct { int age; char name[32]; } student_t; student

ID: 3764374 • Letter: #

Question

#include <stdio.h>
typedef struct
{
int age;
char name[32];
}
student_t;
student_t get_student_info(void);
int main(void)
{
student_t students[100];
for (int i=0; i<100; i++)
{
students[i] = get_student_info();
}
}
student_t get_student_info(void)
{
student_t student;
printf("Enter student name: "); scanf("%s", &student.name[0]);
printf("Enter student id: "); scanf("%i", &student.id);
return student;
}

4) Using a for loop and getStudentInfo() function, get input of all the students

5) Using a for loop and printStudentInfo() function, print all the output of all students.

Explanation / Answer

#include <stdio.h>
typedef struct
{
int id;
char name[32];
}
student_t;
student_t get_student_info(void);
int main(void)
{
student_t students[100];
for (int i=0; i<100; i++)
{
students[i] = get_student_info();
}
}
student_t get_student_info(void)
{
student_t student;
printf("Enter student name: "); scanf("%s", &student.name[0]);
printf("Enter student id: "); scanf("%i", &student.id);
return student;
}