Keywords in C

Keywords in C: Understanding the Building Blocks of the Language

Keywords are an essential part of any programming language, including C. These reserved words have a specific meaning within the language and cannot be used as identifiers or variable names. In this article, we will explore the keywords in C, their uses, and some examples of how they are used in code.


(toc)


Keywords in C

Keywords in C are reserved words that have specific meanings and cannot be used as identifiers. They are essential for the structure and functionality of the language.


List of Keywords in C:

KeywordDescription
autoDeclares automatic storage duration for variables.
breakExits a loop or switch statement.
caseUsed within a switch statement to specify a case.
charDefines a character data type.
constDeclares a constant value.
continueSkips the rest of the current iteration in a loop.
defaultUsed within a switch statement as the default case.
doUsed with while to create a do-while loop.
doubleDefines a double-precision floating-point data type.
elseUsed with if to specify the alternative code block.
enumDefines an enumeration data type.
externDeclares variables or functions defined externally.
floatDefines a single-precision floating-point data type.
forUsed to create a for loop.
gotoUsed to jump to a labeled statement.
ifUsed for conditional statements.
intDefines an integer data type.
longDefines a long integer data type.
registerSuggests to the compiler to store a variable in a register for faster access.
returnReturns a value from a function.
shortDefines a short integer data type.
signedDefines a signed integer data type.
sizeofReturns the size of a data type or variable.
staticDeclares static storage duration for variables or functions.
structDefines a structure data type.
switchUsed for conditional branching based on a value.
typedefCreates an alias for an existing data type.
unionDefines a union data type.
unsignedDefines an unsigned integer data type.
voidIndicates no return type or a function that doesn't return a value.
volatileIndicates that a variable's value can be changed by external factors.
whileUsed to create a while loop.

Key Points:

  • Keywords are reserved words and cannot be used as identifiers.
  • They have specific meanings and functions within the C language.
  • Understanding keywords is essential for writing correct and efficient C code.

#buttons=(Ok, Go it!) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Ok, Go it!