0% found this document useful (0 votes)
235 views2 pages

C Keywords and Identifiers

C programming uses keywords and identifiers to name variables, functions, and other entities. Keywords are reserved words like int and double that have special meanings, while identifiers can be any name that follows naming rules. This document discusses the character set and special characters used in C, lists all the keywords and their uses, and explains the rules for naming valid identifiers.

Uploaded by

Basant Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
235 views2 pages

C Keywords and Identifiers

C programming uses keywords and identifiers to name variables, functions, and other entities. Keywords are reserved words like int and double that have special meanings, while identifiers can be any name that follows naming rules. This document discusses the character set and special characters used in C, lists all the keywords and their uses, and explains the rules for naming valid identifiers.

Uploaded by

Basant Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

C Keywords and Identifiers

In this tutorial, you will learn about keywords; reserved words in C programming
that are part of the syntax. Also, you will learn about identifiers and how to name
them.

Character set
A character set is a set of alphabets, letters and some special characters that are
valid 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 special
meanings to the compiler. Keywords are part of the syntax and they cannot be used
as an identifier. For example:

int money;

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

As C is a case sensitive language, all keywords must be written in lowercase. Here


is a list 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
All these keywords, their syntax, and application will be discussed in their
respective topics. However, if you want a brief overview of these keywords without
going further, visit List of all keywords in C programming.

C Identifiers
Identifier refers to name given to entities such as variables, functions,
structures etc.

Identifiers must be unique. They are created to give a unique name to an entity to
identify it during the execution of the program. For example:
int money;
double accountBalance;
Here, money and accountBalance 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 uppercase and lowercase letters), digits
and underscores.
The first letter of an identifier should be either a letter or an underscore.
You cannot use keywords as identifiers.
There is no rule on how long an identifier can be. However, you may run into
problems in some 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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy