Q..What is c tokens? explain few of them

Ans.. token  in c is the most important element to be used in creating a program in c. we can define the token as the smallest individual element in c. for example, we cannot create a sentence without using words, similarly we cannot create a program in c. without using tokens in c. therefore, we can say that token in c is the building block or the basic component for creating a program in c language.

#classification of tokens in c.

Tokens in c language be divided into the following categories.

  1. Keyword in c
  2. Identifiers in c
  3. String in c
  4. Operator in c
  5. Constant in c
  6. Special characters in c
  1. Keyword in c….

Keyword in c can be define as the predefined or the reserved words having its own importance, and each keyword use by the compiler so they cannot be used as the variable  name it mains that we are assigning a different meaning to the keyword, which is not allowed .keywords cannot use as an identifier.all keywords are basically a sequence of character that have a fixed meaning. c language supports 32 keyword given below.

  1. Identifiers in c….

Identifier in c used for naming variable, function, array, structures etc. identifier in c are the user defined word. It can be composed of uppercase letter, lowercase letter, underscore, or digits, but the starting letter should be either an underscore or an alphabet. Identifier cannot be used as keywords , rules for constructing identifier in c below.

  1.  Identifier only contain numbers letter lowercase and uppercase letter
  2.  Variable name only start with alphabet and  underscore but not use two successive underscores.
  3. Variable name never start with digits
  4. Identifier name are case sensitive. 
  5. Keywords cannot be used as identifier.

3. String in c….

String in c represented as an array of characters having null \0 at the end of the string in c are unclosed within double quotes, while characters are unclosed within single characters that  the string contains.

4. Operators in c….

Operator in c is a special symbol  used to perform the functions, the data item in which the operator are applied are know as operands operator are applied between the  operands . depending on the number of the operands.it is three types unary,binary and ternary.

And it has 10 categories..

5. Constant in c….

Constant are identifiers whose vale do note changed.while value is variable can be changed at any time ,values of constant can never be changed.constant are used to fixed value it is four type of constant integer type,floating point type,character type and string type

#there are two ways of declaring constant:

  1. Using const keyword 
  2. Using define preprocessor

6. Special characters in c….

Like in natural languages, computer language also use a character set that defines the fundamental units used to represent information.a special character in use is in also alphabet ,digits, symbol used to represent to all information.

Some rule its

  1. English alphabet to both upper case(A-Z) and lower case (a-z) lettrs.
  2. Include numerical digits(0-9).
  3. Include all symbol (~!,@.#,$,%,^,&,*,(,),_,+,{,},|,:,”,<,>,?,,,.,/,’,;,\,],[,=,-,`,).
  4. Space is the special character.
  5. White space include

       \b=blank space

      \t=Horizontal tab

      \v=vertical return

      \r=carriage return

      \f=Form feed

     \n=new line

One thought on “Q..What is c tokens? explain few of them

Leave a comment

Design a site like this with WordPress.com
Get started