What are Keywords in C?

Keywords are preserved words that have special meaning in C language. The meaning of C language keywords has already been described to the C compiler. These meaning cannot be changed. Thus, keywords cannot be used as variable names because that would try to change the existing meaning of the keyword, which is not allowed.(Don’t worry if you do not know what variables are, you will soon understand.) There are total 32 keywords in C language.

autodoubleintstruct
breakelselongswitch
caseenumregistertypedef
constexternreturnunion
charfloatshortunsigned
continueforsignedvolatile
defaultgotosizeofvoid
doifstaticwhile

What are Identifiers?

In C language identifiers are the names given to variables, constants, functions and user-define data. These identifier are defined against a set of rules.

Rules for an Identifier

  1. An Identifier can only have alphanumeric characters(a-z , A-Z , 0-9) and underscore(_).
  2. The first character of an identifier can only contain alphabet(a-z , A-Z) or underscore (_).
  3. Identifiers are also case sensitive in C. For example name and Name are two different identifiers in C.
  4. Keywords are not allowed to be used as Identifiers.
  5. No special characters, such as semicolon, period, whitespaces, slash or comma are permitted to be used in or as Identifier.

When we declare a variable or any function in C language program, to use it we must provide a name to it, which identified it throughout the program, for example:

int myvariable = “Studytonight”;

Here myvariable is the name or identifier for the variable which stores the value “Studytonight” in it.

Character set

In C language characters are grouped into the following catagories,

  1. Letters(all alphabets a to z & A to Z).
  2. Digits (all digits 0 to 9).
  3. Special characters, ( such as colon :, semicolon ;, period ., underscore _, ampersand & etc).
  4. White spaces.

Here is a quick video to explain all about keywords and Identifiers

Related Posts

© 2024 Software Engineering - Theme by WPEnjoy · Powered by WordPress