Keyword in C Programming Language – definition and examples

13342

What is Keyword in C programming language?

In C programming language a predefined set of reserved words provides computed control of various functions and declares in C compiler pre-processing libraries which perform special functions. The basic instructions are built up using a reserved set of words, for example main, for, if, else, switch, while, default, double, extern, for, and int, etc., Programming language C demands that they are used only for giving commands or making statements. The programmer cannot use the default, for example, as the name of a variable. An attempt to do so will result in a compilation error.

In formal keywords are standard forms of identifiers that have standard predefined meanings in the C compiler. Keywords are all lowercase since uppercase and lowercase characters are not equivalent because C programming supports Case sensitivity, So it’s possible to utilize an uppercase keyword as an identifier but it’s not a good programming practice.

Note:

  1. Keywords are the words whose meaning has already been explained to the C compiler and their meanings cannot be changed. Hence keywords are also called ‘Reserved words’.
  2. Keywords can be used only for their intended purpose.
  3. Keywords serve as basic building blocks for program statements.
  4. Keywords can’t be used as programmer defined identifier.
  5. The keywords can’t be used as names for variables.
  6. All keywords must be written in lowercase.
  7. 32 keywords available in C.

Also check: Software engineering and system engineering difference

Rules and Restrictions apply to keywords in C Programming Languages:

There have some predefined rules and restrictions that are followed by the developers about to initialize and used the keywords in C programming languages;

  • Keywords are the words whose meaning has already been explained to the C compiler and their meanings cannot be changed.
  • Keywords can be used only for their intended purpose.
  • Keywords cannot be used as developer variables.
  • All keywords must be written in lowercase.

List of standard keywords in C programming language :

Data types Qualifiers  User-defined Storage Classes Loop Decision Jump Derived function Other
 
int signed enum extern for if goto struct void const
char unsigned   register while else continue union return volatile
float short   static do switch break     sizeof
double long    auto   case        
default

Brief introduction of standard keywords and their specification:

Also check: Media access control in mobile computing

Data type Keywords:

int Specifies the integer type of value a variable will hold
char Specifies the character type of value a variable will hold
float Specifies the single-precision floating-point of value a variable will hold
double Specifies the double-precision floating-point type of value a variable will

 

Qualifier Keywords:

signed   Specifies a variable can hold positive and negative integer type of data
unsigned Specifies a variable can hold only the positive integer type of data
short Specifies a variable can hold fairly small integer type of data
long Specifies a variable can hold fairly large integer type of data

 

Loop Control Structure Keywords

for Loop is used when the number of passes is known in advance
while Loop is used when the number of passes is not known in advance
do Loop is used to handle menu-driven programs

 

User-defined type Keywords

typedef Used to define a new name for an existing data type
enum Gives an opportunity to invent own data type and define what values the variable of this data type can take

 

Jumping Control Keywords

break Used to force immediate termination of a loop, bypassing the conditional expression and any remaining code in the body of the loop
continue Used to take control to the beginning of the loop bypassing the statements inside the loop
goto Used to take control of required place in the program

 

Attempt Free C Programming MCQ Quiz

Previous QuizIdentifiers of C Programming Languages
Next Quiz‘auto’ keyword of C programming language

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.