Question: #include // Assign the value of 5 to the integer variable pointed // to by ptr. // // This should only take one line of
| #include | |
| // Assign the value of 5 to the integer variable pointed | |
| // to by ptr. | |
| // | |
| // This should only take one line of code! | |
| void | |
| set_to_five(int *ptr) | |
| { | |
| // TODO: Your code here. | |
| assert(0); | |
| } | |
| // Return the sum of all elements in the given array. The array | |
| // "arr" has "n" elements. | |
| // | |
| // Note that before, we used pointers to reference single variables | |
| // in memory, but now we are using them to refer to many elements. | |
| // The "arr" pointer points to the first element in the array in memory. | |
| // Because pointers themselves don't carry any length information | |
| // (like array objects do in Java), we generally have to pass in a | |
| // length parameter to functions which use pointers to reference | |
| // arrays. | |
| int | |
| array_sum(int *arr, int n) | |
| { | |
| // TODO: Your code here. | |
| assert(0); | |
| return -1; | |
| } | |
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
