Write a C program to dynamically allocate a 2D matrix of size rows x cols using an array of pointers, read elements, and print them row by row.
First line: rows and cols. Subsequent lines: matrix elements.
Print matrix elements row by row separated by spaces.
1 <= rows, cols <= 10
2 2 1 2 3 4
1 2 3 4
Allocate an array of row pointers (`int**`), allocate memory for each row separately, populate data, print, and properly free all allocated memory.
#include <stdio.h>
#include <stdlib.h>
int main() {
int rows, cols;
if (scanf("%d %d", &rows, &cols) == 2) {
// Write your code here to allocate and handle dynamic 2D matrix
}
return 0;
}Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used