#include <iostream>
using namespace std;
int main() {
// your code goes here
uint16_t a;
((uint8_t*)&a)[0] = 0b0;
((uint8_t*)&a)[1] = 0b00000100;
//копируем куда угодно
uint8_t b = ((uint8_t*)&a)[0];
uint8_t* ptr = ((uint8_t*)&a) + 1;
std::cout << "Number:\t\t" << a << std::endl;
//используем скопированное значение
std::cout << "First uint8:\t"<< unsigned(b) << std::endl;
//указатель на него
std::cout << "Scnd uint8:\t\t"<< unsigned(*ptr) << std::endl;
//или прямой доступ
std::cout << "First uint8:\t"<< unsigned(((uint8_t*)&a)[0]) << std::endl;
std::cout << "Scnd uint8:\t\t"<< unsigned(((uint8_t*)&a)[1]) << std::endl;
//PS unsigned() не нужен, но без него выводит как char
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CgkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCgl1aW50MTZfdCBhOwoJKCh1aW50OF90KikmYSlbMF0gPSAwYjA7CgkoKHVpbnQ4X3QqKSZhKVsxXSA9IDBiMDAwMDAxMDA7CgkKCS8v0LrQvtC/0LjRgNGD0LXQvCDQutGD0LTQsCDRg9Cz0L7QtNC90L4KCXVpbnQ4X3QgYiA9ICgodWludDhfdCopJmEpWzBdOwoJdWludDhfdCogcHRyID0gKCh1aW50OF90KikmYSkgKyAxOwoJCglzdGQ6OmNvdXQgPDwgIk51bWJlcjpcdFx0IiA8PCBhIDw8IHN0ZDo6ZW5kbDsKCS8v0LjRgdC/0L7Qu9GM0LfRg9C10Lwg0YHQutC+0L/QuNGA0L7QstCw0L3QvdC+0LUg0LfQvdCw0YfQtdC90LjQtQoJc3RkOjpjb3V0IDw8ICJGaXJzdCB1aW50ODpcdCI8PCB1bnNpZ25lZChiKSA8PCBzdGQ6OmVuZGw7CgkvL9GD0LrQsNC30LDRgtC10LvRjCDQvdCwINC90LXQs9C+CglzdGQ6OmNvdXQgPDwgIlNjbmQgdWludDg6XHRc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