Question: Code needs to be written in C. Thank you Write a program that takes the following array data (you can hard-code it in): array[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20} and

 Code needs to be written in C. Thank you Write a

Code needs to be written in C. Thank you

Write a program that takes the following array data (you can hard-code it in): array[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20} and uses a pointer to assist in displaying certain information about this array. The address of the pointer, the address referenced by the pointer, and the actual data stored at the referenced address should be outputted as shown in the following representative output. The program should first prompt the user for one number from 1 to 4 . This number, the increment, determines how many array elements to jump at a time when printing. When the last possible element of the array is reached, the program should decrement back at the same rate to the beginning of the array. When incrementing, store the address of the array element into the pointer by indexing the array (e.g., ptr =&array[i];; ) When decrementing, however, decrement the pointer itself (e.g., ptr =ptr1; ). To scan in the increment value, you may use the getchar( ) function. However, realize that when a character is inputted, followed by the return key, the next getchar( ) function will retrieve the return character from the keyboard buffer. You can add an extra getchar( ) line to flush this return character from the buffer. You could also use scanf ("%c%", \&ch ; to throw away the return character from the input buffer. Also, based on the operating system, a "return" or "enter" might be read as a "line feed". Assume the user will only input one letter at a time (followed by the "return"/"enter")

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 Databases Questions!