#include "stdio.h"
int main(void) {
int arr[5] = {25,26,78,98,108};
int n = 5;
int key = 655;
int position = 3;
for(int i = 0; i < 5; i++){
printf("arr[%d] = %d\n", i, arr[i]);
}
for(int j = n-1; j >= position; j--){
arr[j+1] = arr[j];
}
arr[position] = key;
printf("\n");
printf("\n");
for(int i = 0; i < 6; i++){
printf("arr[%d] = %d\n", i, arr[i]);
}
return 0;
}
This snippet works well in reply.it, but it doesn't work on codeblocks. Its giving some strange or garbage output in codeblocks and I am not understanding why??