C++ Compound Data Types Practice Problems
C++ Compound data types are those data types that are created from in-built data types to provide a different way to use them. They are created to suite the need of a particular task in which the in-built data types fall short.
Practicing problems is one of the most effective ways to improve programming fluency in any language. This article provides a structured way to master key compound data types in C++ such as arrays, pointers and references, strings, structures, etc.
Easy Problems
These problems are the absolute basics of compound data types and mainly focuses on demonstrating their basic operations.
- Size of an Array
- Array Traversal
- Array Traversal in Reverse
- Count the Zeros in an Array
- Decrement Array Values
- Sum of All Array Elements
- Address Operator
- Call by Reference
- Length of a String
- Substring
Medium Problems
Medium problems require the implementation of compound data types in some simple practical applications. It generally includes problems that builds your intuition of where you can use these datatypes.
- Search an Element in an Array
- Check if an Array is Sorted
- Slice the String
- Count Words in a String
- Getline - 1
- Getline - 2
- Reverse a String
- Palindrome String
- Print Different Characters in Sorted Manner
- Anagram Check
- Structure - Area Calculation
- Self-Referential Structures
- Maximum in Structure Array
- Implement Union
Hard Problems
These problems require the complete understanding of these data types. These generally contains complex problems that also includes the use of other concepts.
- Add Two Complex Numbers
- First Occurrence of Substring
- Transpose of a Matrix
- Multiply Matrices
- Sum of Diagonal Elements
- Find One Extra Character
- Pangram Checking
Prerequisite
You must have the knowledge of the following concepts along with compound data types to solve these problems:
- Variables and Data Types
- Input and Output
- Operators
- Control Statements and Loops
- Functions
- Array and Strings
- Pointers and Strings
- Structure and Unions
It also requires the basic mathematical knowledge. If you want to revise these concepts, refer to GeeksforGeeks' C++ Tutorial.
How to solve practice problems?
Each of the above link will take you to the practice portal where the problem statement tells you all the required information about the problem, and you have to write the solution in the code editor.

Once your solution is complete, you can check it for example test case using the compile and run button at the bottom right of the page.

If you are sure of your solution, press the submit button. The GfG's compiler will run your solution for a variety of test cases and if all these cases are passed, you solution will be accepted.
Your own custom cases can also be checked before submission by using Custom Input button but keep in mind to follow the program's input layout.