For example: sizeof(char*) returns 4. As does int*, long long*, everything that I’ve tried. Are there any exceptions to this?
For example: sizeof(char*) returns 4. As does int* , long long* , everything that
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.
The guarantee you get is that
sizeof(char) == 1. There are no other guarantees, including no guarantee thatsizeof(int *) == sizeof(double *).In practice, pointers will be size 2 on a 16-bit system (if you can find one), 4 on a 32-bit system, and 8 on a 64-bit system, but there’s nothing to be gained in relying on a given size.