Tokens in C

inportance of Tokens in C programming

In a passage of text, individual words and punctuation marks are called Tokens.

Tokans:

      A smallest individual unit of program is known as a token, C programs are written using these tokens and the syntax of the language.
      Tokens are divide into 6 different parts.

    1. keywords

    2. identifiers/variables

    3. constants

   4.  string

   5.  special characters(symbols)

   6.  operators

tokens of c language

  1. keywords:

      Reserve word in c language are known as a keyword. Every keyword has a fix meaning and this meaning cannot be changed, all keyword must be written in lowercase.

      There are 32 keywords are available in C programming such as:

break, case, char, const, continue, default, do, else, enum, extern, float, for, goto, if, long, register, return, short, signed, sizeof, static, switch, typedef, union, unsigned, void, volatile, while, auto, double, int, struct,

      All keywords display in white colours in editing window.

2. Identifiers/variables:

      Identifier is refer to the name of variable, function, array.
      It is known as a variables and generally used for store the information

Example:
int a;


      Where 'a' is a variable which is store the decimal value.

int a;
float xyz;
char c;

Here are following rules we must follow.
      Character of variable must start with alphabet and underscore.
Example:

float 9x; //wrong
int _a; // correct
char $d; //wrong
char d; // correct

      Only capital 'A' to 'Z' or small 'a' to 'z' digit 0 to 9 and _ underscores are allowed.
Example:

int a1c; // correct
int a@c; // wrong
int a_c; // connect

      White space special character are not allowed.
Uppercase and lowercase are distinct
Name of variable consist minimum 1 characters maximum 32 characters.

3. constants:

      Value of variable cannot be changed during execution of program is known as a constant
Example:

int b=10;
char='x';

4. string:

      It refers collections of characters or a single character.
In C programming we can define single character and string as per follow
Example:

char c[10]="xyz"; // correct
char c='x'; // correct
char c="x"; //wrong

5. Special characters(symbol):

      Symbol except digits, whitespaces, letters are known as a special symbol or character.
Example:

{} ; & % $ # @ () ~ ? [] !

6. Operators:

      Basically operator is a symbol which perform a specific task,
there are some of the example of operator given below.
Example:

+ addition
- subtraction
* multiplication
/ division
% reminder

« structure of C programming

» Data types in c language

Learn C programming language