Wednesday, March 23, 2016

C Tokens and Identifiers

What is identifiers, tokens and variables.Every C word is classified as either keyword or identifier. All keywords have fixed meaning and these meanings cannot be changed.Keywords serve as basic building blocks for program statements.

C Identifiers & Tokens

Idnetifer refers to the name of variables,functions and arrays.These are user-defined names and cionsist of a sequence of letters and digits, with a letter as a first character.Both Uppercase and lowercase letters are permitted, although lowercase letters are commonly used. The underscore character is also permitted in identifiers.

C Tokens Chart

  • In c programming individual words characters etc are called as tokens.
  • Tokens are building blocks of C programming.

Token Example


SNOToken TypeExample 1Example 2
1keyworddowhile
2Constantsnumbersum
3Identifier-7789
4String"aaa""soft"
5Special symbols@*
6Operators++/

Basic Building Blocks and Definition:

TokenMeaning
KeywordA variable is a meaningful name of data storage location in computer memory. When using a variable you refer to memory address of computer
ConstantsConstants are expressions with fixed value
IdentifierThe Identifier is usually used for variable names
StringSequence of characters
Special symbolSymbols other than the alphabets Digits and white spaces
OperatorsA symbol that represent a specific mathematical or non mathematical action

Keywords in c programming language

  1. keywords are those words whose meaning is already defined by compiler
  2. Cannot be used as a variable name
  3. There are 32 keywords in C
  4. C keywords are also called as Reserved Keywords.

32 keywords in C programming

autodoubleintstruct
breakelselongswitch
caseenumtypedefregister
charexternreturnunion
constfloatshortunsigned
continueforsignedvoid
defaultgotosizeofvolatile
doifstaticwhile

2 comments: