fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. unsigned char memory[0x1000];
  8.  
  9. const size_t video_mem_row_size = 64;
  10. const size_t video_mem_offset = 0xF00;
  11. typedef unsigned char video_mem_row[video_mem_row_size];
  12.  
  13. video_mem_row* video_mem = (video_mem_row*)(memory + video_mem_offset);
  14.  
  15. size_t test_rows = 3;
  16. for (int i = 0; i < test_rows; i++)
  17. for (int j = 0; j < video_mem_row_size; j++)
  18. video_mem[i][j] = j;
  19.  
  20. bool check_failed = false;
  21. for (int k = 0; k < test_rows * video_mem_row_size; k++)
  22. if (memory[video_mem_offset + k] != k % 64)
  23. check_failed = true;
  24.  
  25. cout << boolalpha << check_failed << endl;
  26. return 0;
  27. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
false