Home > Articles

This chapter is from the book

Summary

In this lesson, you learned about using memory to store values temporarily in variables and constants. You learned that a variable has a size determined by its type and that the operator sizeof() can be used to determine the size of a variable. You got to know different types of variables, such as bool, int, and so on, and that they are to be used to contain different types of data. The right choice of a variable type is important in effective programming, and the choice of a variable that’s too small for the purpose can result in a wrapping error or an overflow situation. You learned about the keyword auto, which you use to let the compiler decide the data type for you on the basis of the initialization value of the variable.

You also learned about the different types of constants and usage of the most important ones among them, using the keywords const, constexpr, and enum.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.