Why we write "sizeof" | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why we write "sizeof"

7th Jan 2020, 8:05 PM
Thisari Kanchana
Thisari Kanchana - avatar
2 Answers
0
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()
7th Jan 2020, 8:08 PM
Jnn
Jnn - avatar
0
Specify a language in your tags to improve context clarity 👍
7th Jan 2020, 10:17 PM
Ipang