C++ Programming

Determine the type of each of the following literals. Explain the differences among the literals in each of the four examples: (a) ’a’, L’a’, "a", L"a" (b) 10, 10u, 10L, 10uL, 012, 0xC (c) 3.14, 3.14f, 3.14L (d) 10, 10u, 10., 10e-2

(a) 

    ’a’     :    character literal

    L’a’   :   wide character literal

   “a”     :   string literal

    L”a”  :  string wide character literal

(b)

     10    : decimal

     10u  : unsigned decimal

     10L  : long decimal

     10uL: unsigned long decimal

     012  :octal

     0xC : hexadecimal

 (c)  3.14  :  double

        3.14f  :  float

        3.14L :  long double

(d) 10     :  decimal

      10u    : unsigned decimal

      10.      :  double

      10e-2  :  double

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments