Default size of a pointer in SoloLearn Challenges | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Default size of a pointer in SoloLearn Challenges

If is not specified in a challenge, I could assume its 4 bytes?

11th Nov 2020, 2:08 PM
Juan Esteban (N/A)
Juan Esteban (N/A) - avatar
3 Answers
+ 1
4 bytes in 32 bits. 8 bytes in 64 bits.
11th Nov 2020, 2:25 PM
你知道規則,我也是
你知道規則,我也是 - avatar
0
it also depends if it is a function pointer. function pointers can be more than 8 or 4 bytes which is why they may not be converted to or from void pointers. i think in C we cannot safely assume the sizes of anything but a char, but what CarrieForle said is usually true most of the time.
11th Nov 2020, 11:10 PM
Mike A
Mike A - avatar
0
Martin Taylor The size of a char is guaranteed to be 1 byte by any ISO standard compiler (not necessarily 8 bits). multibyte/wide char and char are different and treated differently.
12th Nov 2020, 5:16 PM
Mike A
Mike A - avatar