C KEYWORDS – A BRIEF DESCRIPTION

C KEYWORDS - The 32 keywords in C Language

15. GOTO KEYWORD

goto is one of the C keywords which we use in goto statement. The goto statement is an unconditional control statement. It transfers the flow of control to another part of the program.

The goto keyword provides an unconditional jump to a statement present inside a function.

SYNTAX :

goto label;

…. …. ….

…. …. ….

label:

    statement;

    …… ….. ….

    …… ….. ….

Here, label is any valid C identifier which follows by a colon. Whenever the statement goto label encounters, the compiler transfers the control to the statement which is immediately after the label.

EXAMPLE :

main( )

{

int i=8;

if(i%2==0)

  goto even;

else 

  goto odd;

even:

  printf(“number is even”);

  goto end;

odd:

  printf(“number is odd”);

  goto end;

end:

  printf(“\n”);

}

NOTE: Generally, Structured programming does not favours the use of goto statement. Certainly, we can always perform our jobs without using goto.

 

16. IF STATEMENT

Likewise else, if is one of the C keywords which we use in if…else statement. Basically, if statement is one of the four control statements in C Language.

Generally, an if statement checks or tests a condition and executes the statement if the condition is true. Also, we should remember that in C any nonzero value is taken as True while zero is taken as False.

SYNTAX :

if(condition)

{

     statement;

     …. …. …. …

}

Here, we can have a single statement or a block of statements after the if part. Furthermore, if the condition is true i.e. nonzero then the compiler executes the statements of if part.

EXAMPLE :

main( )

{

int i=10;

if(i<20)

  {

    printf(“THE NUMBER IS SMALLER THAN 20”); 

   }

}

Here in the given if part, a condition is true. Therefore, the compiler will execute the statement in the if part.

Hence, the OUTPUT will be..

THE NUMBER IS SMALLER THAN THAN 20

17. INT KEYWORD

int is one of the C keywords which we use for storing any integer value. C supports different types of data. Thus, int is also one of the four fundamental data types. int data type uses int keyword for storing any integer value in a variable.

Generally, int data type takes 2 bytes from the memory. Also, we can classify int data type into following..

  • int or signed int – It takes 2 bytes from the memory and ranges from -32768 to +32767.
  • unsigned int – It also takes 2 bytes from the memory and ranges from 0 to 65535.
  • short int or signed short int – It takes 1 byte from the memory and ranges from -128 to 127.
  • unsigned short int – It also takes 1 byte from the memory and ranges from 0 to 255.
  • long int or signed long int – It takes 4 bytes from the memory and ranges from -2147483648 to 2147483647.
  • unsigned long int – It also takes 4 bytes from the memory and ranges from 0 to 4294967295.

SYNTAX :

keyword_name Variable_name;

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

EXAMPLE :

int a;

int num=10;

In the above example, is a variable of integer data type which store an integer value.

Also, in the other example num is an identifier of int data type. Also, num is having an integer value i.e. 10.

Leave a comment

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

15 thoughts on “C KEYWORDS – A BRIEF DESCRIPTION”