Home > Articles > Programming > C/C++

  • Print
  • + Share This
This chapter is from the book


This chapter discussed numeric and character variables and constants, which are used by C++ to store data during the execution of your program. Numeric variables are either integral (char, short, and long int) or they are floating point (float and double). Numeric variables can also be signed or unsigned. Although all the types can be of various sizes among different computers, the type specifies an exact size on any given computer.

You must declare a variable before it can be used, and then you must store the type of data that you've declared as correct for that variable. If you put too large a number into an integral variable, it wraps around and produces an incorrect result.

This chapter also reviewed literal and symbolic constants as well as enumerated constants, and it showed two ways to declare a symbolic constant: using #define and using the keyword const.

  • + Share This
  • 🔖 Save To Your Account