Problem 4 a. Complete the following setName, getStudentID, and setStudentID func
ID: 3909907 • Letter: P
Question
Problem 4 a. Complete the following setName, getStudentID, and setStudentID functions: #de fine MAX NAME LEN 128 typedef struct char name [MAX_NAME_LEN] unsigned long sid Student; /*return the name of student s const char getName (const Student s) return s-name / set the name of student s/ void setName (Student s, const char name) f / return the SID of student s unsigned long getstudentID(const Student s) I / fill me in/ / set the SID of student s void setstudentID (Student s, unsigned 1ong sid) t /fill me in /Explanation / Answer
void setName(Student *s, const char *name) {
strcpy(s->name, name);
}
unsigned long getStudentID(const Student *s) {
return s->sid;
}
void setStudentID(Student *s, unsigned long sid) {
s->sid = sid;
}
Thanks, PLEASE UPVOTE if helpful
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.