fork(1) download
  1. #include <stdio.h>
  2. int main(int argc, char const *argv[])
  3. {
  4. int tab[]={1,1,1,3,4,1,5,6,7,3}, x=1, c=0;
  5. for (int i = 0; i < 10; ++i)
  6. {
  7. printf("%d\t",tab[i]);
  8. }
  9. printf("\nafter\n");
  10.  
  11. for (int i = 0; i < 10; ++i)
  12. {
  13. if(tab[i]==x){
  14. for (int j = i; j < 10-1; ++j)
  15. {
  16. tab[j]=tab[j+1];
  17. }
  18. i--;
  19. c++;
  20. }
  21. }
  22. for (int i = 0; i < 10-c; ++i)
  23. {
  24. printf("%d\t",tab[i]);
  25. }
  26. return 0;
  27. }
Success #stdin #stdout 0s 5312KB
stdin
Standard input is empty
stdout
1	1	1	3	4	1	5	6	7	3	
after
3	4	5	6	7	3