fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int size = 11;
  5. int A[size];
  6. for (int i = 0 ; i != size ; i++) {
  7. A[i] = i % 2; // A[i] = i & 1; will work as well
  8. }
  9. for (int i = 0 ; i != size ; i++) {
  10. printf("%d ", A[i]);
  11. }
  12. printf("\n");
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 2296KB
stdin
Standard input is empty
stdout
0 1 0 1 0 1 0 1 0 1 0