Keywords in C (original) (raw)

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.

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

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.

Keyword Usage
char Declares a character data type.
int Declares an integer data type.
float Declares a single-precision floating-point type.
double Declares a double-precision floating-point type.
void Specifies no value or return type.
short Declares a short integer.
long Declares a long integer.
signed Declares a signed data type.
unsigned Declares an unsigned data type.

Control Flow Keywords

Used to control the execution flow of a program.

Keyword Usage
if Executes code when a condition is true.
else Executes code when an if condition is false.
switch Selects one block from multiple choices.
case Defines a branch inside a switch statement.
default Executes when no case matches.
for Creates a for loop.
while Creates a while loop.
do Creates a do-while loop.
break Terminates a loop or switch statement.
continue Skips the current loop iteration.
goto Transfers control to a labeled statement.
return Exits a function and optionally returns a value.

Storage Class Keywords

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

Keyword Usage
auto Declares an automatic local variable.
register Requests storage in a CPU register.
static Preserves variable value between function calls.
extern Refers to a variable defined elsewhere.

User-Defined Type Keywords

Used to create custom data types.

Keyword Usage
struct Defines a structure.
union Defines a union.
enum Defines an enumeration.
typedef Creates an alias for an existing data type.

Qualifier Keywords

Used to modify the behavior of variables.

Keyword Usage
const Makes a variable read-only.
volatile Indicates that a variable may change unexpectedly.
restrict Specifies exclusive access to an object through a pointer (C99).

Memory Management and Utility Keywords

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

Keyword Usage
sizeof Returns the size of a data type or object in bytes.

Related Article

Keyword Vs Identifier