1.6 - Two-dimensional Arrays
Enroll to start learning
You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.
Practice Questions
Test your understanding with targeted questions
What is the declaration for a two-dimensional array with 3 rows and 4 columns?
💡 Hint: Think of the format data_type array_name[num_rows][num_columns];
How would you access the first element in a 2D array called 'data'?
💡 Hint: Remember, array indexing starts at 0.
4 more questions available
Interactive Quizzes
Quick quizzes to reinforce your learning
What will int matrix[2][3] = {{1, 2, 3}, {4, 5, 6}}; do?
💡 Hint: Consider both declaration and initialization parts.
Can a two-dimensional array be accessed in a single index?
💡 Hint: Think about how index locations work in arrays.
1 more question available
Challenge Problems
Push your limits with advanced challenges
Write a C++ program that calculates the average of all elements in a 3x3 matrix.
💡 Hint: Don’t forget to initialize your sum variable at 0!
Create a program that takes two 2D arrays, multiplies them, and outputs the resulting matrix.
💡 Hint: Ensure to remember the logic that only certain dimensions can be multiplied together.
Get performance evaluation
Reference links
Supplementary resources to enhance your learning experience.