C++ Dynamic Memory Allocation Exercises with Solutions
C++ Dynamic Memory Allocation [ 10 exercises with solution ]
[An editor is available at the bottom of the page to write and execute the scripts. Go to the editor]
1. Write a C++ program to dynamically allocate an integer, a character and a string and assign a value to them.
2. Write a C++ program to dynamically allocate an array of integers and strings and initialize its elements.
3. Write a C++ program to dynamically allocate two two-dimensional arrays of floating values and strings. Initialize its elements.
4. Write a C++ program to dynamically allocate memory for a character and a string. Input a character and a string from the user.
5. Write a C++ program to dynamically create an object of a class using the new operator.
6. Write a C++ program to dynamically create an array of objects using the new operator.
7. Write a C++ program to dynamically allocate memory for a structure and input its members from the user.
8. Write a C++ program to dynamically allocate memory for a linked list and perform basic operations like insert and delete node(s).
9. Write a C++ program to dynamically allocate memory for a stack data structure. Implement push and pop operations on this stack.
10. Write a C++ program to dynamically allocate memory for a queue data structure. Implement enqueue and dequeue operations on this queue.
CPP Code Editor:
More to Come !
Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join