C KEYWORDS – A BRIEF DESCRIPTION

C KEYWORDS - The 32 keywords in C Language

12. EXTERN KEYWORD

We use extern keyword for giving a reference of a global variable to all the program files. By using extern, we can not initialise the variable. Why! because all it does is point the variable name at a storage location which the compiler has already defined.

The extern keyword defines a storage class for all the Global variables that are visible to all objects. We use extern keyword for representing EXTERNAL STORAGE CLASSES.

Certainly, there’s a limit in scope for all the other storage class variables. Also, we can declare extern storage class variables outside any function block.

SYNTAX :

keyword_name data_type variable_name;

In the above syntax, keyword_name is extern. Similarly, Data_type and variable_name would be of user’s choice.

Therefore, it can be writ ten as extern int a;

EXAMPLE :

int num=1;

main( )

{

   printf(“NUMBER IS %d”,num);

}

OUTPUT

NUMBER IS 1

 

13. FLOAT KEYWORD

float is one of the C keywords which we use for storing single precision floating point number. Likewise double, float is also one of the four fundamental data types.

Also, we use both double and float keywords for storing floating point number. Furthermore, the only difference between the two is –

  • We use float keyword for storing single precision floating point number. While,
  • We use double keyword for storing double precision floating point number.

Generally, a float data type takes 4 bytes from the memory. Talking about the range, a float data type ranges from 3.4E-38 to 3.4E+38.

SYNTAX :

keyword_name Variable_name;

Here, float is the keyword name and variable name will be of user’s choice.

EXAMPLE :

float a;

float num=12.04;

In the above example, “a” is a variable which can store a single precision floating point number.

Furthermore, in the other example the user initialises a value 12.04 to a variable num.

 

14. FOR KEYWORD

for is one of the C keywords which we use in statement such as for statement. The for statement is a very powerful statement in C programming. It is very useful while programming in C.

The general explaination of a for statement is given below through the Syntax.

SYNTAX :

for(initialisation; test_condition; updation)

{

  statement;

  …. …. … .. .

}

In the above for Statement, there are three expressions that are initialisation, test_condition and updation expression.

The initialisation expression executes only once i.e. when the loop starts. We use the initialisation expression for initialising the loop variables. This is generally an assignment expression i.e. we assign values to the variables.

Furthermore, the test_condition expression is a condition. Also, the compiler tests this particular condition before each iteration of the loop. The test_condition generally uses relational and logical operators.

The Updation expression is an update expression. The compiler executes the update expression each time after the body of the loop executes.

Also, the body of the loop can be a single statement or a block of statements.

Flowchart of FOR Loop - C KEYWORDS
https://www.programtopia.net

Given above is the flowchart of FOR Loop..

EXAMPLE :

main( )

{

  int i;

  for(i=1;i<=10;i++)

  {

    print(“%d “,i);

  }

}

OUTPUT

1 2 3 4 5 6 7 8 9 10

Leave a comment

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

15 thoughts on “C KEYWORDS – A BRIEF DESCRIPTION”