Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem 2: Match each of the following statements with the explanation of what t

ID: 3837871 • Letter: P

Question

Problem 2:  Match each of the following statements with the explanation of what the statement does. (NOTE: One of the descriptions listed below actually matches two statements)

Statement Description 1. string * fp; a. sets a pointer variable to the last element of an array of five strings 2. string fish[ 5 ]; b. sets the string pointed to by a pointer variable to the value "salmon"   3. fp = &fish[ 4 ]; c. sets the fourth element of an array pointed to by the variable fp to the value "salmon" 4. *fp = "salmon"; d. moves the pointer fp back three strings in the array it points to 5. fp -= 3; e. initializes a boolean to true if the pointer variable fp points to the string at the start of the fisharray, false otherwise 6. *(fp + 3) = "salmon";    f. declares a pointer variable to point to a variable of type string 7. fp[ 0 ] = "salmon"; g. declares a five element array of string 8. bool b = (fp == fish); h. initializes a boolean to true if fppoints to a string whose value matches the string immediately following the string pointed to by fp,  
false otherwise 9. bool b = (*fp == *(fp + 1));   

Explanation / Answer

Statement Description 1. string * fp; f. declares a pointer variable to point to a variable of type string 2. string fish[ 5 ]; g. declares a five element array of string 3. fp = &fish[ 4 ]; a. sets a pointer variable to the last element of an array of five strings 4. *fp = "salmon"; b. sets the string pointed to by a pointer variable to the value "salmon"   5. fp -= 3; d. moves the pointer fp back three strings in the array it points to 6. *(fp + 3) = "salmon";    c. sets the fourth element of an array pointed to by the variable fp to the value "salmon" 7. fp[ 0 ] = "salmon"; b. sets the string pointed to by a pointer variable to the value "salmon"   8. bool b = (fp == fish); e. initializes a boolean to true if the pointer variable fp points to the string at the start of the fisharray, false otherwise 9. bool b = (*fp == *(fp + 1));    h. initializes a boolean to true if fppoints to a string whose value matches the string immediately following the string pointed to by fp,   false otherwise

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote