My issue
not working
My code
#include <stdio.h>
int main() {
int arr[100] = {4, 5, 3, 10, 12, 18}; // Initial array
// Current size of the array
int size=6;
int newPosition = 5; // Index where you want to insert the new element
int newElement = 7; // Element to be inserted
// Shift elements to make space for the new element
for(int i=size;i>i;i--){
arr[i]=arr[i-1];
}
int newPosition= 5;
int newElement= 7;// Insert the new element at the specified position
arr[newPosition]=newElement;
// Update the size of the array
for(int i=0;i<=size;i++){
printf("%d",arr[i]);
}
// Print the updated array
return 0;
}
Learning course: Data structures & Algorithms lab
Problem Link: https://www.codechef.com/learn/course/muj-aiml-dsa-c/MUJADSAC05/problems/DSAAGP07A