What is the use of sizeof | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the use of sizeof

Data_types

14th Jul 2019, 5:47 AM
Mohit Goud Vicky
Mohit Goud Vicky - avatar
2 Answers
+ 1
It gives you the size of the datatype/variable. For example, it can be used to get the length of the array: int[] arr = {1, 2, 3, 4, 5}; printf("%d", sizeof(arr) / sizeof(int));
14th Jul 2019, 5:54 AM
Airree
Airree - avatar
0
Tq
14th Jul 2019, 6:00 AM
Mohit Goud Vicky
Mohit Goud Vicky - avatar