Introduction to Keywords in C

In C programming, keywords are reserved words that have a predefined meaning and cannot be used as identifiers (variable names, function names, etc.). Keywords are integral to the syntax of the C language and perform specific actions. In C there are 32 keywords in C.

List of Keywords in C

The C language has a set of standard keywords. Below is a list of commonly used C keywords:

Here is the list of 32 keywords in C:

Examples of Common Keywords in C

Below are examples demonstrating the use of several common keywords in C:

Example 1: Using Data Type Keywords

int age = 25;
float height = 5.9;
char grade = 'A';

In this example, int, float, and char are data type keywords that define the type of variables.

Explanation of Example 1: Using Data Type Keywords

Example 2: Using Control and Loop Keywords

int i;
for (i = 0; i < 10; i++) {
    if (i % 2 == 0) {
        continue;
    }
    printf("%d is odd\n", i);
}

Here, for, if, and continue are control and loop keywords that manage the flow of the program.

Explanation of Example 2: Using Control and Loop Keywords

Example 3: Using Storage Class Keywords

static int count = 0;
extern int globalVar;

The keyword static specifies a persistent storage class, while extern is used to declare an external variable.

Explanation of Example 3: Using Storage Class Keywords

Best Practices for Using Keywords

Conclusion

Keywords in C programming are essential for building the language’s syntax. Knowing how to use them effectively will allow you to write clear, structured, and error-free programs. By mastering keywords, you can better utilize C’s built-in functionalities.