Write a complete program that declares an int pointer and an int in main(). main
ID: 3628384 • Letter: W
Question
Write a complete program that declares an int pointer and an int in main(). main() willmake three function calls. main() calls a void function called GetArrayAlloc1() that
interacts with the user. main() then fills the array with numbers and displays them. The
allocated memory is then deleted. main() then calls a second void function,
GetArrayAlloc2() that also interacts with the user. main() fills this array with numbers,
displays them, then deallocates the memory. Finally, main()calls a value-returning
function, GetArrayAlloc3() that again interacts with the user. main() fills this array with
numbers and displays them, then deallocates the memory and ends.
void GetArrayAlloc1( <to be filled in> )
This function takes two parameters, an int pointer reference and an int reference. The
function asks the user what size array he/she would like (must be a positive int, size ?? 1).
An array of ints is allocated off the heap using the new function. The array is sent back to
main() using the int pointer reference (first) parameter. The size of the array is sent to
main() using the int reference (second) parameter.
void GetArrayAlloc2( <to be filled in> )
This function takes two parameters, an int pointer pointer and an int reference. The
function asks the user what size array he/she would like (size ?? 1). An array of ints is
allocated off the heap. The array is sent back to main() using the int pointer pointer (first)
parameter. The size of the array is sent to main() using the int reference (second)
parameter.
int* GetArrayAlloc3( <to be filled in> )
This function takes one parameter, an int reference only. The function asks the user what
size array he/she would like (size ?? 1). An array of ints is allocated off the heap using the
new function. The size of the array is sent to main() using the int reference parameter,
then the array is returned to main().
Can you paste a sample run for this program plz. Thanks a lot
Explanation / Answer
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.