A.Akhileshwar Reddy
Character set
C Keywords
Idenifiers
 Character set is a set of alphabets, letters and some special characters that are
valid in C language.
Alphabet:
Uppercase letters:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Lowercase letters:
a b c d e f g h I j k l m n o p q r s t u v w x y z
C accepts both lowercase and uppercase alphabets as variables and functions.
Digits:
1 2 3 4 5 6 7 8 9 0
We can use digits in the identifiers. But there some restrictions.
Special Characters:
Special characters in C language
Keywords are:
 predefined, reserved words used in programming that have special meanings to
the compiler.
 Part of syntax and cannot be used as an identifier.
Ex: int name;
Here, ‘int’ is a keyword that indicates ‘name’ is a variable of type integer.
As C is a case sensitive language, all keywords must be written in lowercase
letters.
The list of keywords that are allowed in C & ANSI C languages are as follows.
auto double int struct
break else long switch
case enum register typedef
char extern return union
continue for signed void
do if static while
default goto sizeof volatile
const float short unsigned
 Data type Keywords
 int Specifies the integer type of value a variable will hold
 char Specifies the character type of value a variable will hold
 float Specifies the single-precision floating-point of value a variable will hold
 double Specifies the double-precision floating-point type of value a variable will hold.
 Qualifier Keywords
 signed Specifies a variable can hold positive and negative integer type of data
 unsigned Specifies a variable can hold only the positive integer type of data
 short Specifies a variable can hold fairly small integer type of data
 long Specifies a variable can hold fairly large integer type of data
 Qualifier Keywords
 signed Specifies a variable can hold positive and negative integer type of data
 unsigned Specifies a variable can hold only the positive integer type of data
 short Specifies a variable can hold fairly small integer type of data
 long Specifies a variable can hold fairly large integer type of data
 Loop Control Structure Keywords
 For Loop is used when the number of passes is known in advance
 While Loop is used when the number of passes is not known in advance
 Do Loop is used to handle menu-driven programs
 User-defined type Keywords
 typedef Used to define a new name for an existing data type
 Enum Gives an opportunity to invent own data type and define what values the
variable of this data type can take
 Jumping Control Keywords
 Break Used to force immediate termination of a loop, bypassing the conditional
expression and any remaining code in the body of the loop
 continue Used to take the control to the beginning of the loop bypassing the
statements inside the loop
 Goto Used to take the control to required place in the program
 Storage class keywords:
An Identifier:
 refers to the name of an entity such as variable, function, structure, union etc.
 Must be unique. They are created to give an unique identity to an entity to
identify it during the execution of the program.
 Ex:
int name;
double salary;
Here, ‘name’ and ‘salary’ are identifiers, ‘int’ and ‘double’ are keywords.
 Name should be different from keywords.
i.e. cannot use keywords as identifiers.
Rules for writing an identifier:
1. A valid identifier can have letteres, digits and underscores.
2. The first letter of an identifier should not be a digit or underscore.
3. First letter should be a letter either uppercase or lowercase.
4. There is no rule on length of an identifier
5. . The first 31 characters of an identifier are discriminated by the compiler.
C keywords and identifiers

C keywords and identifiers

  • 1.
  • 2.
  • 3.
     Character setis a set of alphabets, letters and some special characters that are valid in C language. Alphabet: Uppercase letters: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Lowercase letters: a b c d e f g h I j k l m n o p q r s t u v w x y z C accepts both lowercase and uppercase alphabets as variables and functions.
  • 4.
    Digits: 1 2 34 5 6 7 8 9 0 We can use digits in the identifiers. But there some restrictions. Special Characters: Special characters in C language
  • 5.
    Keywords are:  predefined,reserved words used in programming that have special meanings to the compiler.  Part of syntax and cannot be used as an identifier. Ex: int name; Here, ‘int’ is a keyword that indicates ‘name’ is a variable of type integer. As C is a case sensitive language, all keywords must be written in lowercase letters.
  • 6.
    The list ofkeywords that are allowed in C & ANSI C languages are as follows. auto double int struct break else long switch case enum register typedef char extern return union continue for signed void do if static while default goto sizeof volatile const float short unsigned
  • 7.
     Data typeKeywords  int Specifies the integer type of value a variable will hold  char Specifies the character type of value a variable will hold  float Specifies the single-precision floating-point of value a variable will hold  double Specifies the double-precision floating-point type of value a variable will hold.  Qualifier Keywords  signed Specifies a variable can hold positive and negative integer type of data  unsigned Specifies a variable can hold only the positive integer type of data  short Specifies a variable can hold fairly small integer type of data  long Specifies a variable can hold fairly large integer type of data
  • 8.
     Qualifier Keywords signed Specifies a variable can hold positive and negative integer type of data  unsigned Specifies a variable can hold only the positive integer type of data  short Specifies a variable can hold fairly small integer type of data  long Specifies a variable can hold fairly large integer type of data  Loop Control Structure Keywords  For Loop is used when the number of passes is known in advance  While Loop is used when the number of passes is not known in advance  Do Loop is used to handle menu-driven programs
  • 9.
     User-defined typeKeywords  typedef Used to define a new name for an existing data type  Enum Gives an opportunity to invent own data type and define what values the variable of this data type can take  Jumping Control Keywords  Break Used to force immediate termination of a loop, bypassing the conditional expression and any remaining code in the body of the loop  continue Used to take the control to the beginning of the loop bypassing the statements inside the loop  Goto Used to take the control to required place in the program
  • 10.
  • 11.
    An Identifier:  refersto the name of an entity such as variable, function, structure, union etc.  Must be unique. They are created to give an unique identity to an entity to identify it during the execution of the program.  Ex: int name; double salary; Here, ‘name’ and ‘salary’ are identifiers, ‘int’ and ‘double’ are keywords.  Name should be different from keywords. i.e. cannot use keywords as identifiers.
  • 12.
    Rules for writingan identifier: 1. A valid identifier can have letteres, digits and underscores. 2. The first letter of an identifier should not be a digit or underscore. 3. First letter should be a letter either uppercase or lowercase. 4. There is no rule on length of an identifier 5. . The first 31 characters of an identifier are discriminated by the compiler.