Close
Close

I can’t understand what siezof ?

   Sharonya Banerjee

Siezof it really hard for me to understand as I am a 12year old girl!


Answers

  •   

    Sizeof() returns the number of bytes that a variable takes up in memory. You need to understand that data types like: int, double, float, etc allocates (make available) memory for the variable. So an int takes up 4 bytes (32 bits), a double takes up 8 bytes (64 bits). So when you have something like this: 

     

    int number = 5;  // ← this takes up 4 bytes of memory because it is an integer variable

    sizeof(number) // ← prints 4 because number (which is an integer variable) takes of bytes of memory.


    • Thanks a lot
      - Sharonya Banerjee

  •   

    see, sizeof returns the memory space taken by a variable depending on its data type in bytes.



Ask Yours
Post Yours
Write your answer