November 26, 2024

C tokens, Identifiers, variables, constants, keywords, and Operator.

The basic and smallest element used to develop the program and recognized by the C compiler is called C tokens. C token is an individual part of the program.

The following part of the program is c tokens:

  1. Keyword
  2. Constant and Variable
  3. Operator
  4. Identifier

Keyword

The keyword is a predefined word in C whose meaning has already been defined by C Compiler. All the keywords have fixed meanings and these meanings cannot be changed.

In C programming there are 32 keywords and they must be written in lowercase.

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

Constants and Variables

Constants

A value that does not change during the execution of the program is called a constant. Constant value remains as it is until the written code is changed. for example, if you write the expression 5+5 as a constant, its value is always a 10 whenever is executed it.

There are four types of constants.

  1. Integer constant:

An integer constant refers to a sequence of digits. for example, 75,85, 155, etc

2. Floating Point constant:

A constant that consists of a whole number as well as a fraction part or exponent part that may be either positive or negative including zero is called a floating constant. for example, +4.5,-6.4,-75 etc

3. Character constant:

A character constant is a printable alphanumeric character, digits, and special characters must be written within a pair of single quotes. for example, ‘R’, ‘z’, ‘8’ etc

4. String Constant:

It is a combination of different characters enclosed within double quotes. for example, “Ram”, “2072”, “Ram072” etc

Variable

A variable is a name given to the memory location which is used to store different types of data in the computer’s memory and that data may change during the program execution.

Leave a Reply

Your email address will not be published. Required fields are marked *