casts to unsigned char* and not char * :
i have learned that one using char* we are telling the compiler the reserve one bit for the sign of the number (in the address the pointer points to ) .
ok so i have implemented memcpy but i cast to char* instead of unsigned char* and then called it to copy a number which is represented as (255, 255, 255, 255) bytes .
the expected behavior is that when reading we will read the while number (255) , but when trying to store the number should overflow .
however this wasn't the case for some reason , why ?
What do you mean by overflow
the value which we want to store exceeds the available memory available for it , for example storing int in a char
Обсуждают сегодня