c ++数组*(int *)((char *)ptr + 8)= 4;

#include <iostream>

#define print(x) std::cout << x;
#define println(x) std::cout << x << std::endl;

int main() {
    int ex[5];
    int* ptr = ex;
    for (int i = 0; i < 5; i++) {
        ex[i] = 2;
    }
    ex[2] = 3;
    *(int*)((char*)ptr + 8) = 4;
    println(ex[2]);
}

on line 13 i'm using (char*) and when i run println(sizeof(char*)) it says that it's 4 bytes but my instructor says that it's 1 byte long so we need to add 8 bytes to access the value in ex[2], how could this be possible i didn't understand ! :/