C KEYWORDS – A BRIEF DESCRIPTION

C KEYWORDS - The 32 keywords in C Language

9. DOUBLE KEYWORD :

double is one of the C keywoon which we use for double precision floating point numbers. Generally, double is one of the four fundamental data types.

Generally, a double data type takes 8 bytes from the memory.

Likewise char, double is a fundamental data type and it also has two types of type qualifiers.

  • double, that takes 8 bytes from the memory and ranges from 1.7E-308 to 1.7E+308.
  • long double, that takes 10 bytes from the memory and ranges from 3.4E-4932 to 1.1E+4932.

SYNTAX :

Keyword_name variable_name;

EXAMPLE :

double a;

Here, double is the keyword name and a is the variable which will certainly store double precision floating point number.

 

10. ELSE KEYWORD

else is one of the C keywords which we generally use in if…else statement.

if…else is a bi-directional conditional statement. There is a certain use of this statement i.e. for testing a condition and choosing one of the two possible actions.

Furthermore, we use the else keyword in the if..else statement as it helps in taking out one of the two possible actions.

The else keyword comes in action when the test condition becomes false. Hence, the compiler executes the statements of the else part.

If the test condition becomes true, then the compiler executes the statements in if. Otherwise, the compiler executes the statements of the else part.

SYNTAX :

if(condition)

   { 

       statement;

        … …. ….. …

   }

else

   {

       statement;

        …. …. …. …

   }

In the above syntax, If the test condition becomes true then the compiler executes the if statements. And if not, then the compiler executes the else statements.

Flowchart of if...else control statement - C KEYWORDS
https://www.programiz.com

Given above is the flowchart of if…else control statement…

EXAMPLE :

main( )

{

int a=10;

if(a>20)

  {

     printf(“The number is greater than 20”);

  }

else

  {

     printf(“The number is smaller than 20”);

  }

}

Given above is just a small example of if..else statement and the use of else keyword. In the example, the test condition becomes false and hence the compiler will execute the else part.

OUTPUT

The number is smaller than 20

 

11. ENUM KEYWORD

As words speak more than numbers and this is the reason for the inclusion of ENUMERATION in C.

An enum is one of the C keywords which is a user defined Data type. This keyword can take values only from a list of named integer constants which are enumerators.

We use enum keyword for representing integer constants as some meaningful and descriptive names. Hence, it enhances the readability of the code and makes it self documenting.

SYNTAX :

enum tag

                 {

                   member1;

                   member2;

                   …. …. …. ..

                   …. …. …. ..

                 };

In the above syntax, enum is the keyword. tag is an Identifier that specifies the name of the new enumeration type being defined. And member1, member2 are the identifiers representing integer constants. Also, these integer constants are enumerator constants or enumerators.

EXAMPLE :

enum month

                        {

                         Jan, Feb, Mar, Apr, 

                         };

Therefore, the enumerators will take the following values,

Jan    0

Feb    1

Mar   2

Apr    3

Or..

enum month{ Jan, Feb, Mar=4, Apr };

Therefore, the enumerators will take the following values,

Jan    0

Feb    4

Mar   5

Apr    6

 

Leave a comment

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

15 thoughts on “C KEYWORDS – A BRIEF DESCRIPTION”