fork download
  1. #include <iostream>
  2.  
  3. const uint8_t happyFace [8] ={
  4. 0b00000000,
  5. 0b00100100,
  6. 0b00100100,
  7. 0b00000000,
  8. 0b00000000,
  9. 0b01000010,
  10. 0b00111100,
  11. 0b00000000,
  12. };
  13.  
  14. int main()
  15. {
  16. const uint8_t * displayEmoji = happyFace; // pointer to happyface
  17.  
  18. for (uint8_t i = 0; i < 8; i++) // for each bytes in the array pointed by displayEmoji
  19. {
  20. uint8_t b = displayEmoji[i]; // store it
  21.  
  22. for (uint8_t j = 0; j < 8; j++) // for each bit in this byte
  23. {
  24. printf("%c", b & 1 ? '*' : ' '); // print '*' if the bit is set, else print ' '
  25. b >>= 1; // shift 1 bit to the right for the next iteration
  26. }
  27. printf("\n");
  28. }
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0s 5524KB
stdin
Standard input is empty
stdout
        
  *  *  
  *  *  
        
        
 *    * 
  ****