1. Assume the following function header: void fn( int &n; ). Write an instructio
ID: 3655711 • Letter: 1
Question
1. Assume the following function header: void fn( int &n; ). Write an instruction for the function body that will store 10 into the caller's variable referred to by n. 2. How is a structure different from an array? 3. Declare an array of 10 Person structures named peopleArray. 4. Assume the following structure definition: struct Person { char name[50]; int age; }; Write a declaration for a variable of type Person and initialize it with your name and the age 10. This should be done as part of the variable declaration statement. 5. Write a calling statement for the changeLetter function. It takes one argument: a reference to a character and returns nothing. The calling statement should pass the char variable ch so that it is (potentially) altered.Explanation / Answer
1. void fn( int &n ){ n=10;// store 10 into the caller's variable referred to by n. } 2. structures can have different types of variables. All array elements must be the same type. 3 Person peopleArray[10]// Declare an array of 10 Person structures named peopleArray. 4. struct Person { char name[50]; int age; }; Person Me; Me.name="Anon"; Me.age=10; 5. void changeLetter(char &ch){}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.