C Assume the following: • A is a structure variable with members ma, mb, and mc. Members ma and mb are integers, member
Posted: Tue Jul 05, 2022 10:25 am
C
Assume the following:• A is a structure variable with members ma, mb, and mc. Members maand mb areintegers, member mc is a string.• B is a structure variable with the same data type as A.• C is a structure of variable with members mu, and mv. Member muis a single precisionfloating point, and member mv has the same data type as A.• L is a 1D array of 10 structures. Each array element has the samedata type as A.• M is a 2D array of structures. There are 4 rows and 5 columns.Each array element hasthe same data type as C.• pa is a structure pointer variable. Its value is the address ofA.• pb is a structure pointer variable. Its value is the address ofB.• pc is a structure pointer variable. Its value is the address ofC.
You need to demonstrate that you know how to access an elementor a member of agroup. For example, how do you access member ma of A? Or how do youget the string lengthof mc inside B?
Refer to the Table below. The 1st column shows the item number,the 2nd column shows thename of the variable to be used as entry point, the 3rd columnshows what element to accessor what to do with the element, the 4th column shows the operatorsthat you must use foraccessing the element. Finally, the 5th column shows the expression(answer). If the 4thcolumn is blank, it means that there is no restriction on whatoperator to use. Study the fiveexamples given in the first five rows (denoted by Ex. 1 to Ex. 5)to guide you in coming up withthe correct expressions/answers.
VERY IMPORTANT: Fill-up the last column. When you type youranswer, make sure that:
1. there is NO blank space in between characters; for example:do not type ( * pa ) . ma, itshould be (*pa).ma2. there are no unnecessary parentheses3. there is no semicolon
Your answers will be checked automatically by Canvas withpre-encoded minimalist answersusing a strict string comparison. Your answers will be consideredincorrect if you have spacesand/or unnecessary parentheses. Your answer will also be incorrectif you do not use the“must use operator(s)”.
QUESTIONS
Item No. Ex. 1 Ex. 2 Ex. 3 Ex. 4 Ex. 5 Entry Variable A B с pa pb What to access or what to do ma get the string length of mc mc ma increment mb "must use" operators Expression (Answer) dereference operator -> and ++ A.ma strlen(B.mc) C.mv.mc (*pa).ma pb->mb++
Entry Variable L Entry Variable pc Entry Variable M Entry Variable B Entry Variable A What to access or what to do mb of the last array element What to access or what to do increment mu What to access or what to do increment mu of the array element at row index 1, column index 2 What to access or what to do mb What to access or what to do 1st character of mc "must use" operator(s) -> structure pointer operator "must use" operator(s) dereference operator and ++ post increment operator "must use" operator(s) [] and ++ post increment operator "must use" operator(s) "must use" operator(s) [] array indexing operator Expression (Answer) Expression (Answer) Expression (Answer) Expression (Answer) Expression (Answer)
Assume the following:• A is a structure variable with members ma, mb, and mc. Members maand mb areintegers, member mc is a string.• B is a structure variable with the same data type as A.• C is a structure of variable with members mu, and mv. Member muis a single precisionfloating point, and member mv has the same data type as A.• L is a 1D array of 10 structures. Each array element has the samedata type as A.• M is a 2D array of structures. There are 4 rows and 5 columns.Each array element hasthe same data type as C.• pa is a structure pointer variable. Its value is the address ofA.• pb is a structure pointer variable. Its value is the address ofB.• pc is a structure pointer variable. Its value is the address ofC.
You need to demonstrate that you know how to access an elementor a member of agroup. For example, how do you access member ma of A? Or how do youget the string lengthof mc inside B?
Refer to the Table below. The 1st column shows the item number,the 2nd column shows thename of the variable to be used as entry point, the 3rd columnshows what element to accessor what to do with the element, the 4th column shows the operatorsthat you must use foraccessing the element. Finally, the 5th column shows the expression(answer). If the 4thcolumn is blank, it means that there is no restriction on whatoperator to use. Study the fiveexamples given in the first five rows (denoted by Ex. 1 to Ex. 5)to guide you in coming up withthe correct expressions/answers.
VERY IMPORTANT: Fill-up the last column. When you type youranswer, make sure that:
1. there is NO blank space in between characters; for example:do not type ( * pa ) . ma, itshould be (*pa).ma2. there are no unnecessary parentheses3. there is no semicolon
Your answers will be checked automatically by Canvas withpre-encoded minimalist answersusing a strict string comparison. Your answers will be consideredincorrect if you have spacesand/or unnecessary parentheses. Your answer will also be incorrectif you do not use the“must use operator(s)”.
QUESTIONS
Item No. Ex. 1 Ex. 2 Ex. 3 Ex. 4 Ex. 5 Entry Variable A B с pa pb What to access or what to do ma get the string length of mc mc ma increment mb "must use" operators Expression (Answer) dereference operator -> and ++ A.ma strlen(B.mc) C.mv.mc (*pa).ma pb->mb++
Entry Variable L Entry Variable pc Entry Variable M Entry Variable B Entry Variable A What to access or what to do mb of the last array element What to access or what to do increment mu What to access or what to do increment mu of the array element at row index 1, column index 2 What to access or what to do mb What to access or what to do 1st character of mc "must use" operator(s) -> structure pointer operator "must use" operator(s) dereference operator and ++ post increment operator "must use" operator(s) [] and ++ post increment operator "must use" operator(s) "must use" operator(s) [] array indexing operator Expression (Answer) Expression (Answer) Expression (Answer) Expression (Answer) Expression (Answer)