Write a C program which takes 4*4 matrix as input in a 2D array using dynamic memory allocation and prints the matrix.
Answers
Answered by
1
Answer:
int** A = new int*[M];
// dynamically allocate memory of size N for each row. for (int i = 0; i < M; i++)
for (int i = 0; i < M; i++) for (int j = 0; j < N; j++)
// print the 2D array. for (int i = 0; i < M; i++)
{ for (int j = 0; j < N; j++)
// deallocate memory using delete[] operator. for (int i = 0; i < M; i++)
Similar questions