C Keywords

๐Ÿ”‘ C Keywords – Reserved Words You Can’t Use as Names

C keywords are reserved words that have special meaning to the C compiler. These words are part of the language syntax, so you cannot use them as variable names, function names, or identifiers.

๐Ÿ“ƒ List of Common C Keywords

Here are some commonly used C keywords:

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

๐Ÿ“ Example: Using Some C Keywords

Here’s a basic program that uses int, return, if, and else.

#include <stdio.h>

int main() {
    int number = 10;

    if (number > 0) {
        printf("The number is positive.\n");
    } else {
        printf("The number is not positive.\n");
    }

    return 0;
}
  

Try It Now

โŒ What You Shouldn’t Do

You cannot use C keywords as variable names. For example, this will throw an error:

int return = 5; // โŒ Error: 'return' is a keyword
  

Try It Now

๐Ÿง  Quick Tips

  • Keywords are case-sensitive in C (e.g., int is valid, Int is not a keyword).
  • You can use underscores or different names: returnValue, not return.

๐ŸŽฏ Practice Idea

Try writing a program using 5 different C keywords. Can you use for, if, int, return, and break together?