All the other code is correct I just need help implementing the setName, getStud
ID: 3638482 • Letter: A
Question
All the other code is correct I just need help implementing the setName, getStudentID, and setStudentID functions.#define 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) {
/* fill me in */
}
/* return the SID of student s */
unsigned long getStudentID(const Student* s) {
/* fill me in */
}
/* set the SID of student s */
void setStudentID(Student* s, unsigned long sid) {
/* fill me in */
}
Explanation / Answer
void setName(Student* s,const char* name)
{
strcpy(s->name, name);
}
long getStudentID(Student* s)
{
return s->sid;
}
void setStudentID(Student* s,long studentID)
{
s->studentID = studentID;
}
pls rate