← Back to Pointers
Question 687
Heap Allocated Ticket Counter
Heap Allocated Ticket Counter
Allocate exactly ONE int on the heap holding the value 7 and store its address in the pointer ticketCount. The program prints the value, then you must triple it THROUGH the pointer, and the program prints it again. The two cout lines are already written for you. 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:
Tickets sold: 7 Tickets sold: 21
= 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.