← Back to Pointers
Question 689
Heap Array of Multiples of Three
Heap Array of Multiples of Three
Allocate a heap array of SIZE (5) ints and store it in the pointer multiples. Fill the array inside the loop that is already written: multiples[i] must hold the (i + 1)-th multiple of three, so index 0 holds 3, index 1 holds 6, and so on.
The printing loop is already written. Print exactly the output shown in Expected Output.
Free the memory you allocate before the program ends — this question checks for memory leaks.Expected Output:
Multiples: 3 6 9 12 15= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
Pointers
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.