Variables in c programming

    Topics:

    1.Character Set :-
    2.C Tokens :-

  • Keywords & Identifiers 
  • Constants 
  • Integer
  • Floating Point
  • Character, String
  • Enumeration 

     3. Backslash characters / Escape sequences 





      1.Character Set:









2. C tokens:

  •     Smallest individual units is called as ‘Tokens‘.

     

  • Keywords And Identifiers:
  • Every C word is classified either “Keyword” or “Identifier “. 
      Rules for Keywords:
  •          Has fixed meaning 
  •          Meaning can not be changed 
  •          Served as basic building block for program statement. 
  •          Must be written in lower case






Identifiers:
-Refer to names of variables , functions and arrays .

Rules for identifiers:
1.     First character must be an alphabet (or underscore) 
2.     Must consist of only letters, digits or underscore. 
3.     Only first 31 characters are significant. 
4.     Cannot use a keyword
5.     Must not contain white space


Constants:

Constants in C refers to fixed values and do not change during the execution of a program.






  • Integer Constants 
  • Real Constants can be represented as exponential format. mantissa e exponent 
  • Mantissa is either a real number expressed in decimal notation or integer 
  • The exponent is an integer number with an optional plus or minus sign 
  • The letter e can be written in lowercase or uppercase.
  • Single character constants 
  • String constants 
  • Backslash Character constants – useful in output functions  also known as escape sequences.

Escape sequence:



Variables:

  • A data name used to store data values
  •  May take different values at different times of program execution 

  • Rules for variable :
 1.      Should not be keyword 
 2.      Should not contain white space
 3.      Uppercase and lower case are significant
 4.      Must begin with letter ( or underscore) 
 5.      Normally should not be more than eight characters. 







Post a Comment

0 Comments