avr39-ripe

uint16_t to uint8_t display

Apr 1st, 2019
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main() {
  6.     uint16_t arr[5] = {0xFF,0xAA,0xA0A0,0xFF00,0xFFFF };
  7.     uint8_t* ptr = (uint8_t*) &arr[0];
  8.  
  9.     cout << "Low" << "\tHigh" << endl;
  10.     for (int i = 0; i < 10; i++)
  11.     {
  12.         cout << (int) ptr[i] << "\t";
  13.         if ((i > 0) and (i % 2)) cout << endl;
  14.     }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment