fork download
  1. #include <stdio.h>
  2.  
  3. void AltBitArray(int array[][5], int size)
  4. {
  5. int row, column;
  6. int val = 0;
  7.  
  8. for (row = 0; row < size; row++) {
  9. for (column = 0; column < size; column++) {
  10. array[row][column] = val;
  11. val = val ^ 1;
  12. }
  13. }
  14. }
  15.  
  16. int main(void) {
  17. int array[5][5];
  18. AltBitArray(array,5);
  19. for(int i =0; i < 5; i++) {
  20. for(int j =0; j < 5; j++) {
  21. printf("%d ",array[i][j]);
  22. }
  23. printf("\n");
  24. }
  25. return 0;
  26. }
  27.  
  28.  
Success #stdin #stdout 0s 4552KB
stdin
Standard input is empty
stdout
0 1 0 1 0 
1 0 1 0 1 
0 1 0 1 0 
1 0 1 0 1 
0 1 0 1 0