C Keywords





In C, a Keyword is a reserved word that has a special meaning to the compiler. Keywords cannot be used as identifiers, which are names for variables, functions, and other entities.

  • There are 32 keywords in C.
  • Keywords are case-sensitive, so int is different from INT.

Here are some commonly used keywords in the C programming language:

>
Keywords
auto break case char
const continue default do
double else enum extern
float for goto if
int long register return
short signed sizeofstatic
struct switch typedef union
unsigned void volatile while


  1. Data Types:
    • int: Defines an integer type.
    • char: Defines a character type.
    • float: Defines a floating-point type.
    • double: Defines a double-precision floating-point type.
    • void: Represents the absence of type.
  2. Control Flow:
    • if: Used to define conditional statements.
    • else: Used in conjunction with "if" to define alternative conditional statements.
    • switch: Defines a multi-branching statement based on the value of an expression.
    • case: Used within a "switch" statement to define specific cases.
    • default: Used within a "switch" statement to define the default case.
    • while: Defines a loop that executes while a specified condition is true.
    • do: Defines a loop that executes at least once and continues as long as a specified condition is true.
    • for: Defines a loop that executes a specified number of times.
    • break: Terminates the current loop or switch statement.
    • continue: Skips the current iteration of a loop and continues with the next iteration.
  3. Functions:
    • return: Used to exit a function and return a value.
    • void: Specifies that a function does not return a value.
    • main: The entry point function of a C program.
  4. Storage Classes:
    • auto: Specifies automatic storage duration.
    • static: Specifies static storage duration.
    • extern: Specifies external linkage.
  5. Miscellaneous:
    • sizeof: Returns the size in bytes of a type or variable.
    • const: Specifies that a variable's value cannot be changed.
    • typedef: Defines a new type using an existing type.

These are just a few of the keywords in the C programming language. Understanding and utilizing these keywords is essential for writing C programs.