fork download
  1. #include<iostream>
  2.  
  3. void printGrid(const bool (&a)[10][10])
  4. {
  5. for(int i = 0; i < sizeof(a)/ (sizeof(*a)) ; i++){
  6. for(int j = 0; j < sizeof(a)/ (sizeof(*a)) ; j++) {
  7. char x = a[i][j] ? '#' : '?'; // i've using the conditional in my std::cout before, still doesn't work
  8. std::cout << x;
  9.  
  10. }
  11. std::cout<< std::endl;
  12. }
  13.  
  14. }
  15.  
  16. int main(){
  17. bool grid[10][10];
  18. for(int i = 0; i < sizeof(grid)/sizeof(*grid) ; i++){
  19. for(int j = 0; j < sizeof(grid)/sizeof(*grid); j++){
  20.  
  21. grid[i][j] = 1;
  22. }
  23.  
  24. }
  25. printGrid(grid); // this doesn't work
  26. std::cout<<( (grid[0][1]) ? "\n#" : "\n?" ) << std::endl; // this works fine
  27. getchar();
  28.  
  29. } // main
Success #stdin #stdout 0s 3344KB
stdin
Standard input is empty
stdout
##########
##########
##########
##########
##########
##########
##########
##########
##########
##########

#