Page 17 - Modular_V2.0_C++_Flikpbook
P. 17

Following are the keywords of C++:

                   auto          and           break         bool          case          catch         char

                   continue      class         const         do            double        default       delete
                   else          enum          export        explicit      friend        extern        for
                   float         false         goto          if            int           inline        long

                   mutable       not           new           namespace or                public        private
                   protected     return        switch        short         static        signed        sizeof
                   struct        this          template      try           throw         true          union
                   unsigned      using         virtual       void          volatile      while         xor

                 Data Types

                 A data type defines the type of value that a variable can store. For example, a person’s name is
                 stored as a string, while their age is stored as an integer. Data types in C++ are:
                                                         Data Types in C++




                                          Primitive                                       Non-Primitive


                   int       char     float    double     bool      void         class    struct    enum     union

                 Primitive Data Types

                 Primitive data types are built-in or default data types. User can directly use these data types to
                 declare variables. The table below shows the primitive data types along with their size and range:


                         Data Type             Size (in bytes)                          Range
                  short int                            2           -32,768 to 32,767
                  unsigned short int                   2           0 to 65,535

                  unsigned int                         4           0 to 4,294,967,295
                  int                                  4           -2,147,483,648 to 2,147,483,647
                                                                   -9,223,372,036,854,775,808  to
                  long int                             8
                                                                   9,223,372,036,854,775,807

                  unsigned long int                    8           0 to 18,446,744,073,709,551,615
                                                                   -9,223,372,036,854,775,808 to
                  long long int                        8
                                                                   9,223,372,036,854,775,807
                  unsigned long long int               8           0 to 18,446,744,073,709,551,615
                  signed char                          1           -128 to 127

                  unsigned char                        1           0 to 255
                  float                                4           ~ -3.4028235 × 10³⁸ to ~ 3.4028235 × 10³⁸





                                                                                                                  15
                                                                                         Getting Started with C++
   12   13   14   15   16   17   18   19   20   21   22