fork(3) download
  1. #include <stdio.h>
  2. int main() {
  3. int A[] = {1,1,1,1,1,1,1,2,1,1,3,2,2,4,5,2};
  4. int i,j=0;
  5. for (i=0;i<sizeof(A)/sizeof(int);i++) {
  6. if (i == 0 || A[i-1] != A[i]) {
  7. A[j++] = A[i];
  8. }
  9. }
  10. for (i=0;i<j;i++) {
  11. printf("%d ", A[i]);
  12. }
  13. printf("\n");
  14. return 0;
  15. }
Success #stdin #stdout 0.01s 5572KB
stdin
Standard input is empty
stdout
1 2 1 3 2 4 5 2