- All C Keywords – One Complete & Understandable Table
|
Keyword |
C Standard |
Easy Description |
Example / Usage |
|---|---|---|---|
|
auto |
C90 |
Default local variable inside a function |
auto int x = 10; |
|
break |
C90 |
Immediately stops loop or switch |
if(i==5) break; |
|
case |
C90 |
A matching option in switch |
case 1: printf("One"); |
|
char |
C90 |
Stores a single character |
char ch = 'A'; |
|
const |
C90 |
Value cannot be changed |
const int x = 10; |
|
continue |
C90 |
Skips current loop step |
if(i==3) continue; |
|
default |
C90 |
Runs if no case matches |
default: printf("Invalid"); |
|
do |
C90 |
Loop runs at least once |
do{ i++; }while(i<5); |
|
double |
|
Stores large decimal values |
double d = 5.25; |
|
else |
C90 |
Runs when |
else printf("No"); |
|
enum |
|
Creates named integer constants |
enum Day {MON,TUE}; |
|
extern |
C90 |
Uses global variable from another file |
extern int x; |
|
float |
C90 |
Stores decimal numbers |
float f = 3.14; |
|
for |
C90 |
Loop with initialization and counter |
for(i=0;i<5;i++) |
|
goto |
C90 |
Jumps to a labeled statement |
goto label; |
|
if |
C90 |
Executes when condition is true |
if(x>0) |
|
int |
C90 |
Stores whole numbers |
int a = 10; |
|
long |
|
Stores larger integers |
long int x; |
|
register |
C90 |
Suggests faster memory access |
register int i; |
|
return |
C90 |
Sends value back from function |
return 0; |
|
short |
|
Stores smaller integers |
short int s; |
|
signed |
C90 |
Allows positive and negative values |
signed int x; |
|
sizeof |
|
Finds size of variable/type |
sizeof(int) |
|
static |
|
Retains value between function calls |
static int count; |
|
struct |
C90 |
Groups different data types |
struct Student {int id;}; |
|
switch |
C90 |
Multiple condition selection |
switch(choice) |
|
typedef |
|
Creates new name for data type |
typedef int INT; |
|
union |
C90 |
Shares memory for all members |
union Data {int i;}; |
|
unsigned |
|
Stores only positive values |
unsigned int x; |
|
void |
C90 |
No value or return type |
void show() |
|
volatile |
|
Value can change anytime |
volatile int flag; |
|
while |
|
Loop runs while condition is true |
while(i<5) |
|
inline |
|
Suggests faster function execution |
inline int add() |
|
_Bool |
C99 |
Stores true or false |
_Bool flag = 1; |
|
_Complex |
C99 |
Stores complex numbers |
_Complex float z; |
|
_Imaginary |
C99 |
Stores imaginary numbers |
_Imaginary float y; |
|
restrict |
|
Improves pointer performance |
int *restrict p; |
|
_Alignas |
C11 |
Sets memory alignment |
_Alignas(16) int x; |
|
_Alignof |
|
Gets alignment size |
_Alignof(int) |
|
_Atomic |
|
Ensures safe shared access |
_Atomic int count; |
|
_Generic |
|
Selects code by data type |
_Generic(x,int:1) |
|
_Noreturn |
C11 |
Function never returns |
_Noreturn void exit() |
|
_Static_assert |
C11 |
Compile-time condition check |
_Static_assert(1,"OK"); |
|
_Thread_local |
C11 |
Separate variable for each thread |
_Thread_local int x; |
- Key Exam Notes
- 32 keywords in standard C (C90)
- C99 adds 5 keywords
- C11 adds 7 keywords
- Keywords are lowercase & reserved
- Cannot be used as identifiers