Keywords and Identifiers in C

Keywords and identifiers are fundamental concepts in the C programming language. Understanding these concepts is crucial for writing correct and effective C programs. In this tutorial, we will explore keywords and identifiers in C, their significance, and how to use them properly. Whether you are a beginner or an experienced programmer, this guide will provide you with a comprehensive understanding of keywords and identifiers in C.

Let’s dive into the world of C programming and explore keywords and identifiers in detail.

Introduction to Keywords

Keywords, also known as reserved words, are pre-defined words in the C programming language that have specific meanings and functionalities. These words are reserved for the compiler and cannot be used as identifiers (variable names, function names, etc.) in your C programs.

Keywords are an essential part of the C language syntax and form the building blocks of C programs. They provide a set of instructions to the compiler to perform specific tasks or operations. Examples of keywords in C include ifelsewhileintfloat, and many more.

Complete List of C Keywords

Here is a complete list of keywords in the C programming language:

autoDefines an automatic variable
breakTerminates the current loop or switch statement
caseDefines a case statement within a switch statement
charDeclares a character type
constDeclares a read-only variable
continueSkips the current iteration of a loop
defaultSpecifies the default case in a switch statement
doStarts a do-while loop
doubleDeclares a double-precision floating-point type
elseDefines an alternative branch in an if statement
enumDeclares an enumeration type
externDeclares a variable or function as external
floatDeclares a floating-point type
forBegins a for loop
gotoTransfers control to a labeled statement
ifStarts an if statement
inlineSuggests the compiler to perform inline expansion
intDeclares an integer type
longDeclares a long integer type
registerSuggests the compiler to store the variable in a register
returnExits the current function and returns a value
shortDeclares a short integer type
signedDeclares a signed integer type
sizeofReturns the size of a type or variable in bytes
staticDeclares a static variable or function
structDefines a structure
switchStarts a switch statement
typedefCreates a new data type using an existing type
unionDefines a union
unsignedDeclares an unsigned integer type
voidSpecifies an empty type or no value
volatileDeclares a volatile variable
whileBegins a while loop

It’s important to note that the above keywords are case-sensitive in C. Therefore, you must use them exactly as shown in the list.

Understanding Identifiers

Identifiers are user-defined names used to identify various entities in a C program, such as variables, functions, arrays, and labels. In simpler terms, identifiers are like labels that represent specific memory locations where data is stored or instructions are executed.

Unlike keywords, identifiers are not reserved words and can be chosen freely by the programmer. However, there are certain rules and best practices to follow when creating identifiers to ensure readability, maintainability, and avoid conflicts.

Rules for Creating Identifiers

Here are the rules for creating valid identifiers in C:

  1. An identifier can consist of letters (both uppercase and lowercase), digits, and underscores (_), but it must begin with a letter or an underscore.
  2. C is case-sensitive, so uppercase and lowercase letters are considered different. For example, myVariable and myvariable are distinct identifiers.
  3. The length of an identifier can be up to 31 characters.
  4. You cannot use C keywords as identifiers.
  5. Identifiers cannot contain special characters such as @#$, etc.
  6. The use of reserved library function names as identifiers should be avoided.

Following these rules will help you create meaningful and valid identifiers that enhance the readability and maintainability of your code.

Examples of Keywords and Identifiers

Let’s look at some examples to understand the usage of keywords and identifiers in C:

#include <stdio.h>int main() {
    int num1 = 10;  // 'int' is a keyword, 'num1' is an identifier
    float num2 = 3.14;  // 'float' is a keyword, 'num2' is an identifier
    char message[] = "Hello";  // 'char' is a keyword, 'message' is an identifier

    if (num1 > 5) {  // 'if' is a keyword
        printf("%s, World!\n", message);  // 'printf' is a library function name

    return 0;  // 'return' is a keyword

In the above example, we have used keywords such as intfloatcharif, and return. These keywords define the structure and behavior of the program. On the other hand, identifiers like num1num2message, and printf are user-defined names that represent variables, arrays, and functions.

By using proper identifiers and keywords, you can write clear and concise code that is easy to understand and maintain.


Keywords and identifiers are integral parts of the C programming language. Keywords provide predefined meanings and functionalities, while identifiers allow programmers to create meaningful names for variables, functions, and other entities.

In this tutorial, we explored the complete list of keywords in C and discussed the rules for creating valid identifiers. By adhering to these rules and understanding the significance of keywords and identifiers, you can write efficient and error-free C programs.

Remember to choose meaningful and descriptive identifiers to enhance the readability of your code. Practice using keywords and identifiers in your programs, and gradually you will become comfortable with their usage.

Feel free to experiment with different examples and ask questions to solidify your understanding. Happy coding!

[sc_fs_multi_faq headline-0=”h2″ question-0=”What are keywords in C?” answer-0=”Keywords in C are reserved words that have predefined meanings and cannot be used as identifiers for variables, functions, or any other user-defined names. Examples of keywords in C include ‘int’, ‘if’, ‘while’, ‘for’, etc.” image-0=”” count=”1″ html=”true” css_class=””]

[sc_fs_multi_faq headline-0=”h2″ question-0=”What are identifiers in C?” answer-0=”Identifiers in C are user-defined names used to identify variables, functions, structures, or any other entities in a program. An identifier can consist of letters, digits, and underscore symbols, but it must start with a letter or an underscore.” image-0=”” count=”1″ html=”true” css_class=””]

[sc_fs_multi_faq headline-0=”h2″ question-0=”How are keywords and identifiers different in C?” answer-0=”Keywords are reserved words with predefined meanings in C, while identifiers are user-defined names that represent variables, functions, or other entities. Keywords cannot be used as identifiers, but identifiers can be chosen by the programmer based on their needs, as long as they follow the rules for naming identifiers.” image-0=”” count=”1″ html=”true” css_class=””]

[sc_fs_multi_faq headline-0=”h2″ question-0=”Can identifiers be used as keywords in C?” answer-0=”No, identifiers cannot be used as keywords in C. Keywords have predefined meanings and are reserved for specific purposes in the language. Using an identifier as a keyword would lead to a conflict and result in a compilation error.” image-0=”” count=”1″ html=”true” css_class=””]

[sc_fs_multi_faq headline-0=”h2″ question-0=”What is the importance of keywords and identifiers in C?” answer-0=”Keywords and identifiers play crucial roles in programming with C. Keywords provide a set of predefined functionality and structure to the language, enabling programmers to use them for specific purposes. Identifiers, on the other hand, allow programmers to create and name user-defined entities, enhancing the readability and understandability of the code.” image-0=”” count=”1″ html=”true” css_class=””]

Leave a Comment