Keywords in C

Last Updated : 10 Jun, 2026

C keywords are reserved words that have predefined meanings recognized by the compiler. They form the basic building blocks of the C language and cannot be used as identifiers such as variable names, function names, or structure names.

  • Have predefined meanings and form part of the C language syntax.
  • Cannot be used as identifiers such as variable names, function names, or structure names.
C_Keywords
C Keywords
C
#include <stdio.h>

int main(){
    
    int x = 10;

    if (x == 10)
    {
        printf("Successful demonstration of keywords.");
    }
    else
    {
        printf("Failed");
    }

    return 0;
}

Output
Successful demonstration of keywords.

What Happens if We Use a Variable Name Same as a Keyword?

Using a keyword as a variable name results in a compilation error because keywords are reserved by the language.

C
#include <stdio.h>

int main()
{
    int return = 10;

    printf("%d", return);

    return 0;
}

Output:

error: expected identifier before 'return'

Important Points

  • Keywords are reserved words and cannot be used as identifiers.
  • C is a case-sensitive language; if and IF are treated as different tokens.
  • The number of keywords depends on the C standard version.
  • ANSI C (C89/C90) contains 32 keywords.
  • Modern C standards such as C99, C11, and C23 introduce additional keywords.

C Keywords List

The following are the most commonly used keywords in C.

Data Type Keywords

Used to declare variables and define the type of data they can store.

KeywordUsage
charDeclares a character data type.
intDeclares an integer data type.
floatDeclares a single-precision floating-point type.
doubleDeclares a double-precision floating-point type.
voidSpecifies no value or return type.
shortDeclares a short integer.
longDeclares a long integer.
signedDeclares a signed data type.
unsignedDeclares an unsigned data type.

Control Flow Keywords

Used to control the execution flow of a program.

KeywordUsage
ifExecutes code when a condition is true.
elseExecutes code when an if condition is false.
switchSelects one block from multiple choices.
caseDefines a branch inside a switch statement.
defaultExecutes when no case matches.
forCreates a for loop.
whileCreates a while loop.
doCreates a do-while loop.
breakTerminates a loop or switch statement.
continueSkips the current loop iteration.
gotoTransfers control to a labeled statement.
returnExits a function and optionally returns a value.

Storage Class Keywords

Used to define the scope, lifetime, and visibility of variables.

KeywordUsage
autoDeclares an automatic local variable.
registerRequests storage in a CPU register.
staticPreserves variable value between function calls.
externRefers to a variable defined elsewhere.

User-Defined Type Keywords

Used to create custom data types.

KeywordUsage
structDefines a structure.
unionDefines a union.
enumDefines an enumeration.
typedefCreates an alias for an existing data type.

Qualifier Keywords

Used to modify the behavior of variables.

KeywordUsage
constMakes a variable read-only.
volatileIndicates that a variable may change unexpectedly.
restrictSpecifies exclusive access to an object through a pointer (C99).

Memory Management and Utility Keywords

Used for low-level programming and compiler-specific operations.

KeywordUsage
sizeofReturns the size of a data type or object in bytes.

Related Article

Keyword Vs Identifier
Comment