Why we write "sizeof" | SoloLearn: Learn to code for FREE!


Why we write "sizeof"

1/7/2020 8:05:18 PM

Thisari Kanchana

2 Answers

New Answer


In C when you want to allocate memory you need to know the bitsize of a certain type that could be 4 bit for example If you want to allocate memory for an array of 4 elements with a data type that needs 4 bit each you need to have 16 bits in the memory. Because sometimes you cant know how many bits a data type needs you use the function sizeof()


Specify a language in your tags to improve context clarity 👍