


The reserved words are:Īvoid starting the name of a variable with two underscores sometimes, the compiler would think that you are trying to use one of the words reserved for the compiler.Ĭ++ is case-sensitive this means that CASE, Case, case, and Case are four completely different words. The C++ compiler has a list of words reserved for its own use and you must not use any of these words to name your objects or functions. A name could also be a combination of more than one word, such as firstname or Should not be longer than 32 characters (although allowed)Ī name can consist of one word such as country.Cannot include special characters such as !, %, ], or $.Examples are: keyboard, Master, Junction, Player1, total_grade, _Score_Side1 Can include letters, underscore, or digits.Examples are Name, gender, _Students, pRice Starts with an underscore “_” or a letter, lowercase or uppercase, such as a letter from a to z or from A to Z.C++ provides rules for naming items in your program. A variable is primarily recognized by its name. When using the various necessary variables in your programs, you will need to identify each one of them. Once you provide a name, the compiler can use the same item throughout a program. To make the compiler’s job easier, every one of these items or variables must have a name.


Therefore, an item such as the one taking a customer’s name, since it can change (vary) from one customer to another, is called a variable. Since customers’ names are different, they vary from one order to another. Such a program would have an item used to get customers’ names. Since you will not write a new program for each customer, you would make sure that one program can process every kind of order. For example, if you write a program used to register orders for a car repair shop, two customers will hardly have the same issue.įor example, you will likely deal with different names throughout the day. It is very usual that the values given to these items change regularly throughout the lifetime of a program. These items are used to recognize the components of a program. To count the books in a bookstore, you use a number. To identify an employee, you could use a name. For example, to calculate the area of a circle, you would use a radius. To perform its assignments, you use items of various kinds. C++ For C++ Builder - Lesson 1: Variables and Data Types
