What is the use of "sizeof()" operator in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the use of "sizeof()" operator in c++

When is it used?

20th Nov 2020, 4:02 AM
米希尔
米希尔 - avatar
3 Answers
+ 5
sizeof() operator is used to know the size of data type. Example: int a; sizeof(a); Here after printing, output will be 4, because size of int data type is 4 bytes. Similarly size of float is 8 bytes, double is 16 bytes and so on. Hope you will understand.
20th Nov 2020, 4:14 AM
ツSampriya😘ツ
ツSampriya😘ツ - avatar
+ 1
Thanks didi
20th Nov 2020, 4:16 AM
米希尔
米希尔 - avatar
+ 1
I understood
20th Nov 2020, 4:16 AM
米希尔
米希尔 - avatar