Tasks and Solutions: A pointer to a pointer

1) Create a two-dimensional array of 5x5, fill it with random numbers from 10 to 99 and display. Swap the maximum element of each row with the first element in the corresponding row. The problem solved by the pointer.

2) The challenge for the multiplication of matrices. The user arbitrarily sets the dimension of the two arrays and fills the values ​​manually. Do not forget, that it is necessary to allocate the appropriate memory locations for matrices, that the user will fill in for the final third of the matrix. Next, display on the screen, both the matrix and filled the resulting matrix (their play).

Maybe someone knows, how to multiply matrices. Watch this short video (author: Prihodovsky MA)

To support our site – click on the piggy bank and choose any convenient way.

Newsletter of programming:

Tasks and Solutions: A pointer to a pointer
5 (100%) 4 votes

8 thoughts on “Tasks and Solutions: A pointer to a pointer

  1. You are wrong to rid the memory of the second task, after a != c. When you enter the matrix 3×2 and 2×3 gives an error message.
    For the second array to do a separate cycle, and the first and the third may be one in.

  2. Decided Zadachu№1 using pointers in the search for the maximum value. Prokomentirujte please can you do that and how much it is validly?
    P.S.: sorri, I'm still just learning, so this question ))

  3. too awful?

  4. I sdelyal. :) The solution is different from yours, but the program should work correctly, several times I checked.

  5. Correct me, but at the end of the second task, where the memory is freed, incorrectly accounted array sizes, which leads to an error, tk. Quantity M2 series (i in the cycle) must be < with.

Leave a Reply

Your email address will not be published. Required fields are marked *