Question: Problem 1 Filling the array Get the number of elements the user wants in an array. A prompt for the user input is optional. Allocate

Problem 1 Filling the array
Get the number of elements the user wants in an array. A prompt for the user input is optional.
Allocate memory for an array of the appropriate size. Using pointers to walk the array, set the value of each element of the array to its index. In other words, element 0 should be set to 0, element 1 should be set to 1, and so on.
Use the debugger to confirm that your array elements have been set properly.
Problem 2 Printing the array
Using pointers to walk the array, print out the value of each element in the array.
Problem 3 Processing the array
Using pointers to walk the array, calculate the sum of the elements in the array and print the sum. Gauss came up with a very elegant solution that you could modify to use here, but walk the array instead!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!