Sobes.tech
Junior — Senior

Pointer casting and shifting

livecode

Task condition

It is necessary to understand how the program will work if you cast a pointer to an array of integers to the type int8_t*, perform pointer arithmetic, and output the resulting byte.

int data[8] = {1, 1, 1, 1, 1, 1, 1, 1};
int8_t* p = (int8_t*)data;
p += 3;
std::cout << (int)*p << std::endl;