I can't understand the sizeof in C | SoloLearn: Learn to code for FREE!

0

I can't understand the sizeof in C

12/26/2019 6:20:07 PM

Cyber

3 Answers

New Answer

+6

It gives you the sizeof the datatype of the variable not the value of the variable int x = 100; sizeof(x) == 4 x value is 100 but type of x is int and size of int is 4 bytes on 64 bit machine sizeof char is 1 byte float 4 byte double 8 byte pointer 8 byte on 64 bit 4 byte on 32 bit sizeof types is dependent on platform

+2

While this example was written for C++ the logic still holds true for C... https://code.sololearn.com/cBss8k5523i1/#cpp

+1

Thanks for help guys❤