Question: For the following statements indicate which one is True/False. For the False statement(s), write the correct from. (8 marks) a) The snippet bellow is
For the following statements indicate which one is True/False. For the False statement(s), write the correct from. (8 marks) a) The snippet bellow is a part of a larger code in which pA1 refers to a integer array of size 10. All pointers (pA1, pA2, pA3) after line 8 will point to the same variable in the memory. 1 #include 3 int main () { ... int a[10]; a [0] = *pA1; int *pA2 = ka[1]-1; pA3 = a; 9. ... 10 return 0; 11 } b) In the previous code in part a), the values of *pA1+1, *pA2+1, *pA3+1 are the same but the values of * (pAi+1), *(pA2+1), *(pA3+1) may be different. c) If pA is a pointer to an array a, the following line of code causes a segmentation fault. That is, the code may compile but running the code could result in run-time error. 1 pA = a[1]; d) The minimum required change for the following snippet to show all of the values in array a on separate lines is adding or deleting one character. 1 #include 3 int main () { int a[10]; for (int i=a; i
Step by Step Solution
3.41 Rating (160 Votes )
There are 3 Steps involved in it
Lets examine each statement one by one a The statement says pa1 refers to an integer array of size 1... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (2 attachments)
60618495a9aab_55291.pdf
180 KBs PDF File
60618495a9aab_55291.docx
120 KBs Word File
