fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int main() {
  6. int i,j; const int N=10;
  7. int a[N];
  8. int b[N]={0};
  9. printf("Enter mass: \n");
  10. for(i=0;i<N;i++) {
  11. scanf("%d",&a[i]);
  12. b[0]+=a[i];
  13. }
  14. for(i=1;i<N;i++) {
  15. b[i]=b[i-1]-a[i-1]; printf("%5d",b[i]);
  16. }
  17. getchar();
  18. return 0;
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c: In function ‘main’:
prog.c:8:2: error: variable-sized object may not be initialized
  int b[N]={0};
  ^
prog.c:8:2: warning: excess elements in array initializer [enabled by default]
prog.c:8:2: warning: (near initialization for ‘b’) [enabled by default]
prog.c:6:8: warning: unused variable ‘j’ [-Wunused-variable]
  int i,j; const int N=10;
        ^
stdout
Standard output is empty