n C programming, keywords are reserved words that have special meaning in the language. They cannot be used as identifiers (e.g., variable names, function names). Here’s a list of C keywords, along with a brief description of each:
List of C Keywords
- Data Types
int
: Represents integer data types.float
: Represents floating-point data types.double
: Represents double-precision floating-point data types.char
: Represents character data types.
- Control Flow
if
: Used for conditional statements.else
: Used in conjunction withif
for alternative conditions.switch
: Allows multi-way branching.case
: Defines a branch in aswitch
statement.default
: Specifies the default branch in aswitch
statement.break
: Exits from a loop orswitch
statement.continue
: Skips the current iteration of a loop and moves to the next.return
: Exits from a function and optionally returns a value.
- Looping
for
: Starts a for loop.while
: Starts a while loop.do
: Used withwhile
to create a do-while loop.
- Storage Class Specifiers
auto
: Default storage class for local variables.register
: Suggests that a variable be stored in a register for faster access.static
: Indicates that a variable retains its value between function calls.extern
: Declares a variable that is defined in another file or scope.
- Type Qualifiers
const
: Indicates that a variable’s value cannot be modified.volatile
: Indicates that a variable may change unexpectedly (used in hardware access).
- Input/Output
sizeof
: Returns the size of a data type or variable.
- Others
void
: Indicates no value or type, often used for functions that do not return a value.struct
: Defines a structure.union
: Defines a union (a data structure that can hold different data types).enum
: Defines an enumeration (a set of named integer constants).typedef
: Creates an alias for a data type.goto
: Transfers control to a labeled statement (not commonly used).typedef
: Used to create a new name for an existing type.
auto, double, int, struct,
break, else, long, switch,
case, enum, register, typedef,
char, extern, return, union,
const,float, short, unsigned,
continue, for, signed, void,
default, goto, sizeof, volatile,
do, if, static, while,