Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago