C Keywords and Identifiers

C Keywords and Identifiers

In this tutorial, you will find out about keywords; reserved words in C programming that are a piece of the linguistic structure. Also, you will find out about identifiers and how to name them

Character set

A character set is a set of alphabets sets, letters, and some exceptional characters that are legitimate in C language.

Alphabets

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

C accepts both lowercase and uppercase alphabets as variables and functions.

Digits

0 1 2 3 4 5 6 7 8 9

Special Characters

Special Characters in C Programming
,               <             >             .               _
(              )              ;               $              :
%            [              ]              #             ?
‘               &             {              }              “
^             !              *             /              |
–              \              ~             +

White space Characters

Blank space, newline, horizontal tab, carriage, return, and form feed.


C Keywords





Keywords are predefined, reserved words used in programming that have extraordinary implications to the compiler. Keywords are a piece of the syntax structure and they can’t be used as an identifier. For instance:

int money;

Here, int is a keyword that indicates money is a variable of type int (integer).

As C is a case delicate language, all watchwords must be written in lowercase. Here is a rundown of all keywords allowed in ANSI C.

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

C Identifiers

Identifier alludes to the name given to substances, for example, factors, capacities, structures, and so forth.

Identifiers must be one of a kind. They are made to give a novel name to a substance to distinguish it during the execution of the program. For instance:

int money;
double accountBalance;

Here, money and account balances are identifiers.

Also remember, identifier names must be different from keywords. You cannot use int as an identifier because int is a keyword.


Rules for naming identifiers

A valid identifier can have letters (both capitalized and lowercase letters), digits, and underscores.

The primary letter of an identifier ought to be either a letter or an underscore.

You can’t use keywords as identifiers.

There is no standard on to what extent an identifier can be. Be that as it may, you may run into issues in certain compilers if the identifier is longer than 31 characters.

You can choose any name as an identifier if you follow the above rule, however, give meaningful names to identifiers that make sense.


Please feel free to give your comment if you face any difficulty here.

For more Articles click on the below link.

https://www.worldofitech.com/c-introduction/

3 thoughts on “C Keywords and Identifiers”

  1. I am now not positive where you’re getting your information, but great topic.

    I needs to spend a while learning much more or understanding
    more. Thanks for wonderful info I was in search of this info for
    my mission.

  2. Everything is very open with a clear clarification of the issues.
    It was truly informative. Your website is very helpful.
    Thanks for sharing!

Leave a Reply

Your email address will not be published. Required fields are marked *