Skip to main content

IDENTIFIERS AND KEYWORDS

Identifiers are names given to various elements of a program, such as variables, functions and arrays. Identifiers consist of digits and letters, in any order but the rule is first character should be a letter. Anyone can use both uppercase and lowercase letters. But uppercase and lowercase letters are not having same meaning e.g. RAM & ram are not same. The underscore character (_) can also be included and is considered to be a letter. Any identifier can start with underscore character, though this is not a good programming practice. Some of the following names are valid identifiers:

She, Z02, computer_02, _

wind Classes, areal, interest_rate, PERIOD Now, we list out the following names which are not valid identifiers: 2 nd, “y”, ship-no, flag error The first identifier name starting with 2 (i.e. a digit) is not valid, because first character must be a letter, illegal character ‘‘ ’’ is present in the “y” identifier, similarly ship-no, flag error are also invalid identifier name as hyphen & blank character are not allowed in the naming convention of identifiers. An identifier can be arbitrarily long. Some implementation of C recognize only the first eight characters, though ANSI standard recognizes 31 characters.

Unlike identifiers, keywords are certain reserved words that have, standard, predefined meanings in C. These keywords can be used only for their intended purpose, they cannot be used as programmer-defined identifiers. The standard keywords are listed below:

 

 

INTEXT QUESTIONS

1. What is the purpose of /t and /n character?
2. What is the basic difference between keyword and identifier ?
3. Is student-id is correct for identifier’s name or not?

CONSTANTS

Constant in C refers to fixed values that do not change during the execution of a program. C supports four types of constants. They are integer, character, string & floating-point constants. As the name suggests integer & Floating point constants represent numbers. They are often referred to collectively as numeric-type constants The numeric-type constants must follow the following rules:

  •  Commas and blank spaces cannot be included within the constant.
  •  The constant can be preceded by a minus(-) sign if desired.
  •  The value of a constant cannot exceed specified minimum and
  • maximum bounds. For each type of constant, these bounds will
  • vary from one C compiler to another.

An integer constant refers to a sequence of digits. There are three types of integers, namely, decimal, octal and hexadecimal. A decimal integer constant can consist of any combination of digits taken from

the set 0 through 9, proceded by an optional - or + sign. Various
examples of decimal integer constants are:
123, – 345, 0, 5324, +62

An octal integer constant can consist of any combination of digits
taken from the set 0 through 7, with a leading 0. Some examples of
octal integers are: