Isn’t we are only getting the address of a single byte?
Yes. A pointer always points to a single byte since it can only hold a single address. However, the type of the pointer specifies how much memory after the initial address is part of the pointed to value and C++ makes sure that the correct type sizes are used.
Code:
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
unsigned char ca[2 * sizeof(int)];
int ia[2] = {98, 97};
memcpy(ca, ia, 2 * sizeof(int));
int *p0 = (int*)&ca[1 * sizeof(int)];
unsigned char *p1 = &ca[1 * sizeof(int)];
cout<<"Sizeof *p0 "<< sizeof *p0 <<' '<< *p0 <<endl;
cout<<"Sizeof *p1 "<< sizeof *p1 <<' '<< *p1 <<endl;
}