sizeof

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • reon
    New Member
    • Feb 2007
    • 80

    sizeof

    what is the use of sizeof in c++...
  • AdrianH
    Recognized Expert Top Contributor
    • Feb 2007
    • 1251

    #2
    Originally posted by reon
    what is the use of sizeof in c++...
    To get the size of an class or struct or type.
    I.e. sizeof(int) returns the size in bytes of an integer.

    These values can vary from system to system, but can be standardised across systems.


    Adrian

    Comment

    • reon
      New Member
      • Feb 2007
      • 80

      #3
      In a code i saw there using sizeof both in class name and class objects..
      what is the use of putting sizeof in that cases....


      Originally posted by AdrianH
      To get the size of an class or struct or type.
      I.e. sizeof(int) returns the size in bytes of an integer.

      These values can vary from system to system, but can be standardised across systems.


      Adrian

      Comment

      • AdrianH
        Recognized Expert Top Contributor
        • Feb 2007
        • 1251

        #4
        Originally posted by reon
        In a code i saw there using sizeof both in class name and class objects..
        what is the use of putting sizeof in that cases....
        In the case of an object, it will get the size of what ever type that object is. And by type I mean class, struct or base type.


        Adrian

        Comment

        Working...