C tokens
 C tokens are the basic buildings blocks in C
language which are constructed together to
write a C program.
 Each and every smallest individual unit in a C
program is known as C tokens.
C tokens are of six types.
Keywords (eg: int, while),
Identifiers (eg: main, total),
Constants (eg: 10, 20),
Strings (eg: “total”, “hello”),
Special symbols (eg: (), {}),
Operators (eg: +, /,-,*)
VARIABLES
•A meaningful name given to a data storage location in the
computer memory is known as a Variable.
•When a variable is used it actually refers to a address of
the memory where the data is stored.
•A variable name can comprise of letters, digits and
underscore characters.
•The first character has to be an alphabet.
•There should be no commas or blank spaces between the
variable names.
Variable declaration
 data type variable-name;
 int a;
Constants
 The identifiers whose value does not/ cannot
change are known as Constants.
 There are three types of constants:
 Integer Constants - 0,344,-90
 Floating Point Constants - 3.5,90.432
 Character Constants ‘y’ , ‘$’ , ‘%’ , ‘R’
Keywords
 Keywords are pre-defined words in a C
compiler.
 Each keyword is meant to perform a specific
function in a C program.
 Since keywords are referred names for
compiler, they can’t be used as variable name.
 C language supports 32 keywords which are
given on next slide.
. Identifiers
 In C language identifiers are the names given to variables, constants,
functions and user-define data.
or
 Names given to identify Variables, functions and arrays are examples for
identifiers.
Rules for constructing identifier name in C:
 An Identifier can only have alphanumeric characters( a-z , A-Z , 0-9 ) and
underscore( _ ).
 The first character of an identifier can only contain alphabet( a-z , A-Z ) or
underscore ( _ ).
 Identifiers are also case sensitive in C. For example name and Name are
two different identifier in C.
 Keywords are not allowed to be used as Identifiers.
 No special characters, such as semicolon, period, whitespaces, slash or
comma are permitted to be used in or as Identifier.

C Slides

  • 1.
    C tokens  Ctokens are the basic buildings blocks in C language which are constructed together to write a C program.  Each and every smallest individual unit in a C program is known as C tokens.
  • 2.
    C tokens areof six types. Keywords (eg: int, while), Identifiers (eg: main, total), Constants (eg: 10, 20), Strings (eg: “total”, “hello”), Special symbols (eg: (), {}), Operators (eg: +, /,-,*)
  • 3.
    VARIABLES •A meaningful namegiven to a data storage location in the computer memory is known as a Variable. •When a variable is used it actually refers to a address of the memory where the data is stored. •A variable name can comprise of letters, digits and underscore characters. •The first character has to be an alphabet. •There should be no commas or blank spaces between the variable names.
  • 4.
    Variable declaration  datatype variable-name;  int a;
  • 5.
    Constants  The identifierswhose value does not/ cannot change are known as Constants.  There are three types of constants:  Integer Constants - 0,344,-90  Floating Point Constants - 3.5,90.432  Character Constants ‘y’ , ‘$’ , ‘%’ , ‘R’
  • 6.
    Keywords  Keywords arepre-defined words in a C compiler.  Each keyword is meant to perform a specific function in a C program.  Since keywords are referred names for compiler, they can’t be used as variable name.  C language supports 32 keywords which are given on next slide.
  • 8.
    . Identifiers  InC language identifiers are the names given to variables, constants, functions and user-define data. or  Names given to identify Variables, functions and arrays are examples for identifiers. Rules for constructing identifier name in C:  An Identifier can only have alphanumeric characters( a-z , A-Z , 0-9 ) and underscore( _ ).  The first character of an identifier can only contain alphabet( a-z , A-Z ) or underscore ( _ ).  Identifiers are also case sensitive in C. For example name and Name are two different identifier in C.  Keywords are not allowed to be used as Identifiers.  No special characters, such as semicolon, period, whitespaces, slash or comma are permitted to be used in or as Identifier.