What happens when casting between these two in relation to the termination character? In C99 Objective-C.
What happens when casting between these two in relation to the termination character? In
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I assume that a char is 8 bits on your system in this answer.
If your architecture uses
unsigned charaschartype then absolutely nothing will happen.If your architecture uses
signed charaschartype then negative values of char will wrap around causing possibly unexpected results. This however will never happen to the termination null character.Please note, by “casting” nothing really happens, you just tell the compiler to interpret a certain location in the memory differently. This difference in interpretation would create the actual (side)effects of the cast.