Unit 4 - INTRODUCTION TO DATA TYPES, OPERATOR AND EXPRESSION IN C++

Posted on Friday, May 7, 2010 by B[H] | 0 comments
Labels:

The C++ character set includes the keyboard characters, namely the uppercase letter A - Z, the lower letters a – z , the digits 0 – 9 , and other special characters (such as!, #, [, ] , ,&,<,?, and * ). The blank space is also a character in the set.
Identifiers are simply references to memory location which can hold values. They are formed by combining letters (both upper and lowercase), digits and the underscore( _ ). The first character of an identifier, however, must be a letter. The blank character is not permitted in an identifier. Although identifiers can be formed by freely combining the letters, digits and underscores, common sense tells us that
we should give them suggestive names, that is, names that reflect the data items that they are going to store. Identifiers can be of any length although in practice they seldom exceed 25 characters.

Example of valid and invalid identifiers:

Photobucket

C++ identifiers are case-sensitive, meaning, lower and uppercase letter in identifiers are treated as different characters. This means we cannot freely mix the lower and uppercase letter to refer to the same identifier. For example, identifiers HOURLY_RATE, Hourly_Rate, Hourly_rate and hourly_rate are all different, they refer to different memory locations.
Variables are identifiers whose value may change during the course of execution of a program.
Keywords in C++, also called reserved words, have standard, predefined meanings and must be used only for their intended purpose. Programmers therefore should not use these keywords as identifiers.

No comments:

Post a Comment