1. Use the following structure to write a program class_info.c struct student{ c
ID: 3657842 • Letter: 1
Question
1. Use the following structure to write a program class_info.c struct student{ char last_name[30]; int student_id; // five digits char grade; //Explanation / Answer
#include struct student { char *last_name; int student_id; char grade; }; int main(void) { struct student tmp, *p = &tmp; tmp.grade = 'A'; tmp.last_name = "Casanova"; tmp.student_id = 910017; printf("%s%12s%12s %s%12d%12d %s%12c%12c ", "--- " "The information will be listed twice: " " " "Last name:", p -> last_name, (*p).last_name, "Sudent ID:", p -> student_id, (*p).student_id, " Grade:", p -> grade, (*p).grade); return 0; } PROGRAM 931 :main.c #include "class_info.h" int main(void) { int cnt; int i; struct student tmp; struct student class[CLASS_SIZE]; tmp.grade = 'A'; tmp.last_name = "Casanova"; tmp.student_id = 910017; class[0] = tmp; tmp.grade = 'F'; tmp.last_name = "Superman"; tmp.student_id = 910018; class[1] = tmp; tmp.grade = 'C'; tmp.last_name = "Wonderwoman"; tmp.student_id = 910019; class[2] = tmp; /* // Enter nothing for the remainder of the class. */ for (i = 3; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.