Exercises on Complex Data Types

Time to write some code to solve problems.

We'll cover the following

Question 1

Below is a program that uses a struct called Matrix to encapsulate a two-dimensional matrix. The structure definition contains the matrix values and the dimensions of the matrix. Assume that the matrix is filled row by row. Since we haven’t covered dynamic allocation of memory yet, for now, we assume a matrix can hold a maximum number of values equal to 1024.

You’ll be required to write two functions. One for printing a matrix. Another for multiplying two matrices.

Note: For convenience, this question is broken into two independent tasks listed next—after the following code.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy