Monday, 8 August 2016

Tokens, Keywords, Identifiers and Variables

Tokens 
In a passage of text and usual words and punctuation marks are called Tokens. In a C program the smallest individual unit are also known as Tokens.




Keywords 
  1. Keywords have predefined uses and cannot be used for any other purpose in a C program.
  2. They are used by compiler to compile the program.
  3. They are always written in lowercase letters.
  4. There are Thirty two (32) keywords defined in C.

  Identifiers
  
An identifier is a sequence of characters created by the programmer to identify or name a specific object. The sequence of characters may be letters, digits, and the special character ('_' )known as an underscore.  They include variables, arrays,functions, pointers, etc.

Rules for creating Identifiers
  1. Identifiers are case sensitive.
  2. Only alphabets can be used as the first character of the identifier. 
  3. An identifier should not be a keyword  

Variables
  • A variable is an identifier for a memory location in which data can be stored and recalled. 
  • Variables are used for holding data values so that they can be utilized in various computations in a program.
  • All variables have two different attributes -
  1.  A data type is established when a variable is defined. Once defined, the type of C variable cannot be changed.
  2.  The value can be changed by assigning new value to the variable. The type of the values depends upon the data type of the variable.

No comments:

Post a Comment

If u need any help,