Answered step by step
Verified Expert Solution
Question
1 Approved Answer
sample output Pls the code has to follow the instructions exactly and it's a C++ program. thank you Using pointers to dynamically allocate an array,
sample output
Pls the code has to follow the instructions exactly and it's a C++ program. thank you
Using pointers to dynamically allocate an array, and then manipulate that array through pointer arithmetic. Start by declaring a pointer to a string in the main function, and initialize it to NULL. Then, ask the user how many strings they would like to enter, and use your pointer to dynamically allocate an array of that user specified size. Next, pass that array, along with the size, into a function, fillArray...). You should use a pointer parameter to a string to accept the array. Inside the function, use a loop to iterate through the array, prompting the user to enter a value at each element in the array. You should use pointer arithmetic and the pointer/offset notation to accomplish this (not the bracketed pointer/index, or array, notation). Back in the main, pass the newly-filled array and the size into another function, display Array ...), which will similarly loop through the array and display it's contents. How many data elements are there? 5 Enter the first string: 956-555-1337 Enter the first string: 956-555-2345 Enter the first string: 956-867-5309 Enter the first string: 956-110-1100 Enter the first string: 956-524-1748 Element #1: 956-555-1337 Element #2: 956-555-2345 Element #3: 956-867-5309 Element #4: 956-110-1100 Element #5: 956-524-1748 Press any key to continueStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started