Write a program that allocates an array on the heap and


1. Write a C program that creates two arrays of integers, one on the stack and one on the heap. You will loop through these arrays and populate them with values (any value is fine). You will then loop through these arrays again and print each value. Your output should look something like "Value in index 1 is 100 from stack array and 100 from heap array." Do not forget to print newlines. Do not forget to de-allocate any memory you allocate.

2. Write a program that allocates an array on the heap and then iterates through the heap using pointer arithmetic. Print the item as in part 2 at each iteration. Loop backwards through the array using pointer arithmetic and print as well.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write a program that allocates an array on the heap and
Reference No:- TGS01478349

Now Priced at $20 (50% Discount)

Recommended (97%)

Rated (4.9/5)