Define C Language? How would you define in a .h file the following 4 structured
ID: 3813193 • Letter: D
Question
Define C Language?
How would you define in a .h file the following 4 structured data?
1 pProfessor( represents the professor's info)
a) Integer idProfessor
b) Boolean bGerman //if the professorspeaks german//
c) Character cLevel
2. Data type pProfessorVector which stores a vector made u of 4 elements of the type pProfessor
3.Data type pStudent that represents the information of any student
a) Integer idStudent ( range 1 to 999)
b) Boolean bGerman
c) Character cLevel
d) Integer idProfessor
4.Data type pStudentVector that stores a vector of 6 elements of the type pStudent
Finnally , how would we implement a function idsStudent so when we give a variable of the type pStudent , we get the values of the variables idProfessor and idStudent?
And the action updateStudentProfessor which given a variable of type pProfessorVector and pStudent gives this same last variable pStudent with the updated value of idProfessor
Explanation / Answer
struct pProfessor {
int idProfessor;
int bGerman;
char bGerman;
}
struct pProfessorVector {
pProfessor professors[4];
}
struct pStudent {
int idStudent;
int bGerman;
char cLevel;
int idProfessor;
}
struct pStudentVector {
pStudent students[6];
}
void idsStudent(pStudent *p, int *idProfessor , int *idStudent) {
*idProfessor = p->idProfessor;
*idStudent = p->idStudent;
}
pStudent* updateStudentProfessor(pProfessor *prof, pStudent *stud) {
stud->idProfessor = prof->idProfessor;
return stud;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.