Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22151

Codeblocks vs Repl.it

$
0
0
#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??


Viewing all articles
Browse latest Browse all 22151

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>