Keywords and Identifiers In C

Keywords and Identifiers In C

You will learn about Keywords and Identifiers in this tutorial, and reserved terms in the grammar of C programming. You will also discover what identifiers are and how to name them.

In the C programming language, keywords and identifiers serve as the foundation of any program.

An identifier is user-defined, which means you can specify identifiers while building a C language program. Keywords are predefined, which means the C language includes a list of phrases that are Keywords. Let’s examine these two.

Character set(Keywords and Identifiers)

A character set is a collection of letters, alphabets, and special characters recognized by the C programming language.

Alphabets

Uppercase: A B C …………………………….. X Y Z
Lowercase: a b c ……………………………….. x y z

As variables and functions, C accepts both lowercase and uppercase alphabets.

Digits

0 1 2 3 4 5 6 7 8 9

Special Characters

,<>._
();$:
%[]#?
&{}
^!*/|
\~+ 

Characters with no lines

newline, horizontal tab, carriage return, and form feed are all punctuation marks.

C Keywords(Keywords and Identifiers)

Every programming language contains a few reserved terms that are used exclusively within the language and have special meanings. These words are referred to as Reserved Keywords or simply Keywords.

In programming, keywords are preset, reserved terms that have unique definitions to the compiler. Because they are a component of the syntax, keywords cannot be used as identifiers. For instance:

int money;

Money is a variable of type int, as shown by the term int in this sentence (integer).

All keywords must be typed in lowercase since C is a case-sensitive language. The full list of ANSI C-accepted keywords is provided below.

autodoubleintstruct
breakelselongswitch
caseenumregistertypedef
charexternreturnunion
continueforsignedvoid
doifstaticwhile
defaultgotosizeofvolatile
constfloatshortunsigned

Each of these terms, their syntax, and their use will be covered in its own topic. However, you can visit the List of all keywords in C programming if you only want a quick summary of these terms.

C Identifiers

In the C language, identifiers are words or texts that are used to identify anything.

A name assigned to entities like variables, functions, structures, etc. is referred to as an identifier.

Similar to how you have a name that everyone uses to refer to you—John, Ron, Scarlett, Monica, etc.—in the C programming language, we give variables, functions, structures, etc.

names when we define them to make it simpler for us to remember them and use them as needed. Identifiers are the names given to them.

Identifiers need to be distinct. They are made to provide an entity with a special name that will help identify it when the application is running. For instance:

int money;
double accountBalance;

Money and account balance are identifiers in this case.

Also, keep in mind that identifier names and keywords must be distinct. Since int is a keyword, you cannot use it as an identifier.

Identifier naming conventions

Letters (including capital and lowercase letters), numbers, and underscores are all acceptable forms of identification.

An identifier’s first letter should either be a letter or an underscore.

Keywords like “int” and “while” cannot be used as identifiers.

There is no restriction on the length of an identifier. If the identification is greater than 31 characters, you can have issues in some compilers.

If you adhere to the aforementioned criterion, you are free to use any name as an identifier; just give sensible identifiers names that are meaningful.

if you don’t have a compiler use our C Compiler.

Leave a Reply