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

C90

Stores large decimal values

double d = 5.25;

else

C90

Runs when if is false

else printf("No");

enum

C90

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

C90

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

C90

Stores smaller integers

short int s;

signed

C90

Allows positive and negative values

signed int x;

sizeof

C90

Finds size of variable/type

sizeof(int)

static

C90

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

C90

Creates new name for data type

typedef int INT;

union

C90

Shares memory for all members

union Data {int i;};

unsigned

C90

Stores only positive values

unsigned int x;

void

C90

No value or return type

void show()

volatile

C90

Value can change anytime

volatile int flag;

while

C90

Loop runs while condition is true

while(i<5)

inline

C99

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

C99

Improves pointer performance

int *restrict p;

_Alignas

C11

Sets memory alignment

_Alignas(16) int x;

_Alignof

C11

Gets alignment size

_Alignof(int)

_Atomic

C11

Ensures safe shared access

_Atomic int count;

_Generic

C11

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;

Leave a Reply

Your email address will not be published. Required fields are marked *