I need help in this question of C Programming dealing with structs Structs given struct DateTag{ int nMonth; int nDay; int nYear; }; struct NameTag{ char strFirst[ 31 ]; char strLast[ 21 ]; }; struct EmployeeTag{ int nId; struct NameTag sName; struct DateTag sBirth; }; struct DepartmentTag{ char strName[ 21 ]; char strDescription[ 51 ]; struct EmployeeTag sManager; struct EmployeeTag arrEmployees[ 15 ]; }; struct CompanyTag{ char strName[ 31 ]; struct DepartmentTag arrDepartments[ 10 ]; }; struct CompanyTag c1, c2; struct DepartmentTag d1, d2; struct EmployeeTag e1, e2; struct EmployeeTag *pEmp; Assumption that some code exist that initializes ALL values of the structure elements in the variable declarations above. 1a) Which statement(s) is/are syntactically correct? a) e1 = d1.sManager; b) e1 = d1.arrEmployees; c) Both d) None 1b) Which statement(s) is/are syntactically correct? a) d1.arrEmployees[ 0 ] = pEmp; b) pEmp = d1.arrEmployees; c) Both d) None 1c) Which statement(s) is/are syntactically correct? a: c1.d1 = d2; b: c2.arrDepartments[1] = d2; c) Both d) None
I need help in this question of C Programming dealing with structs
Structs given
struct DateTag{
int nMonth;
int nDay;
int nYear;
};
struct NameTag{
char strFirst[ 31 ];
char strLast[ 21 ];
};
struct EmployeeTag{
int nId;
struct NameTag sName;
struct DateTag sBirth;
};
struct DepartmentTag{
char strName[ 21 ];
char strDescription[ 51 ];
struct EmployeeTag sManager;
struct EmployeeTag arrEmployees[ 15 ];
};
struct CompanyTag{
char strName[ 31 ];
struct DepartmentTag arrDepartments[ 10 ];
};
struct CompanyTag c1, c2;
struct DepartmentTag d1, d2;
struct EmployeeTag e1, e2;
struct EmployeeTag *pEmp;
Assumption that some code exist that initializes ALL values of the structure elements in the variable declarations above.
1a) Which statement(s) is/are syntactically correct?
a) e1 = d1.sManager; b) e1 = d1.arrEmployees; c) Both d) None
1b) Which statement(s) is/are syntactically correct?
a) d1.arrEmployees[ 0 ] = pEmp; b) pEmp = d1.arrEmployees; c) Both d) None
1c) Which statement(s) is/are syntactically correct?
a: c1.d1 = d2; b: c2.arrDepartments[1] = d2; c) Both d) None
Step by step
Solved in 2 steps