I have this in my code:
int x = 4; char* array = malloc(x*sizeof(char)); size_t arraysize = sizeof (array); printf(\"arraysize: %zu\\n\", arraysize);
You are calculating the size of the full array (4*sizeof(char)) But you spect to know the number of items on the array (4).
You can do
size_t arraysize = sizeof (array)/sizeof(char);
It will return 8/2 = 4