fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. const int n = 11;
  5.  
  6. int a[n];
  7. int main(int argc, char const *argv[])
  8. {
  9. int i, p, max = -100000, imax = -1;
  10.  
  11. puts("Enter P:");
  12. scanf("%d", &p);
  13.  
  14. for (i = 0; i < n; i++)
  15. {
  16. printf("Enter a[%d]: ", i);
  17. scanf("%d", &a[i]);
  18.  
  19. if (i != 0 && a[i] < 0 && a[i] > max)
  20. {
  21. max = a[i];
  22. imax = i;
  23. }
  24. }
  25.  
  26. memmove(&a[imax + 2], &a[imax + 1], sizeof(int) * (n - imax));
  27.  
  28. a[imax + 1] = p;
  29.  
  30. for (i = 0; i < n + 1; i++)
  31. printf("%d ", a[i]);
  32.  
  33.  
  34. return 0;
  35. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:6:5: error: variably modified ‘a’ at file scope
 int a[n];
     ^
stdout
Standard output is empty