Write a C program to resize a dynamically allocated array using `realloc`, adding new elements and printing the updated array.
First line: initial size n1. Second line: n1 elements. Third line: new size n2. Fourth line: n2 - n1 new elements.
Print the resized array elements separated by spaces.
1 <= n1 < n2 <= 100
3 1 2 3 5 4 5
1 2 3 4 5
Use `realloc` to resize the existing heap memory block, read additional elements into the newly allocated space, and print the entire array.
#include <stdio.h>
#include <stdlib.h>
int main() {
int n1;
if (scanf("%d", &n1) == 1) {
int *arr = (int *)malloc(n1 * sizeof(int));
for (int i = 0; i < n1; i++) {
scanf("%d", &arr[i]);
}
int n2;
scanf("%d", &n2);
// Write your code here to resize array using realloc and read new elements
}
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