Keywords in C Language

Keywords are reserved words in the C programming language that have predefined meanings and cannot be used as identifiers (variable names, function names, etc.). These keywords are used to define the syntax and structure of the language. It is important to have a good understanding of keywords to write valid and meaningful C programs. In this tutorial, we will explore some of the commonly used keywords in C. Here are some important keywords in C:

KeywordDescription
autoSpecifies that a local variable is automatically allocated and deallocated within its scope.
breakTerminates the execution of the current loop or switch statement and transfers control to the next statement.
caseSpecifies a value to compare with the expression in a switch statement. If a match is found, the corresponding code is executed.
charDefines a character variable that can store a single character.
constDeclares a variable as read-only, meaning its value cannot be modified after initialization.
continueCauses the program to skip the current iteration of a loop and proceed with the next iteration.
defaultSpecifies the default code to be executed in a switch statement when none of the cases match the expression.
doInitiates a do-while loop, which repeatedly executes a block of code until a specified condition becomes false.
doubleDeclares a variable that can store decimal numbers with double precision.
elseIndicates an alternative code block to be executed if the condition of an if statement is false.
enumDefines a set of named constants called enumerators.
externDeclares a variable or function as externally defined, meaning it is located in another file or module.
floatDeclares a variable that can store decimal numbers with single precision.
forInitiates a for loop, which repeatedly executes a block of code based on a specified initialization, condition, and increment.
gotoTransfers control to a labeled statement within the same function.
ifExecutes a block of code if a specified condition is true.
intDeclares a variable that can store whole numbers (integer values).
longDeclares a variable that can store larger integer values than int.
registerSuggests that a variable be stored in a register for faster access.
returnTerminates the execution of a function and returns a value (if specified) to the calling function.
shortDeclares a variable that can store smaller integer values than int.
signedDeclares a variable as capable of representing both positive and negative numbers.
sizeofDetermines the size, in bytes, of a variable or a data type.
staticSpecifies that a variable retains its value between function calls and is initialized only once.
structDefines a custom data type (structure) that can hold multiple variables with different data types.
switchEvaluates an expression and executes code based on matching cases.
typedefCreates a new data type with a user-defined name.
unionDefines a special data type that can store different types of data in the same memory space.
unsignedDeclares a variable as capable of representing only positive numbers or zero.
voidSpecifies that a function does not return any value or a variable is of an empty type.
volatileIndicates that a variable can be modified by external factors not known to the compiler.
whileInitiates a while loop, which repeatedly executes a block of code as long as a specified condition is true.

It is important to become familiar with all the keywords in the language to write correct and efficient code. Remember that keywords cannot be used as identifiers, so you should avoid using them as variable names or function names.