C Keywords and Identifiers - C Programing - Rana Tutorials

Rana Tutorials

Saturday, May 23, 2020

C Keywords and Identifiers - C Programing


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


Character set


In C language we can create words, Numbers and Expression using characters based on the coamputer on which the program is running, its character representing the same Alphabet Number or Special symbol. Which is used to represent Intromation.

Alphabets



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


C take  both of  lowercase and uppercase alphabets as variables and  also functions.

Digits



Digit are -: 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 

C Keywords

int money;
Here,  int is a keyword which show that   moneyis a variable of type int  (integer).

You know  C is a case sensitive language, all keywords  is written in lowercase. this  is a list of all keywords allowed in ANSI C.

C Keywords
autodoubleintstruct
breakelselongswitch
caseenumregistertypedef
charexternreturnunion
continueforsignedvoid
doifstaticwhile
defaultgotosizeofvolatile
constfloatshortunsigned

All these keywords, their syntax, and application is discussed in their related  topics. However, if you want a deep  overview of these keywords without going anywhere , visit List of all keywords in C programming.

C Identifiers

Identifiers are names that you give to variables, constants, arrays, and functions, etc. It can also be the name of objects that take different values   but only one at a time

Identifiers must be unique. These are created to give a uneqalled  name to an unit or organisation 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 is different from keywords. You can not use  int as an identifier because int is a keyword.



Rules for naming identifiers


  1. A valid identifier have letters (both uppercase and lowercase letters), digits and underscores. are used as in c
  2. The first letter of an identifier is letter or a underscore
  3. You cannot use keywords as identifiers.
  4. There is no rule on how much long an identifier can be. However, you can run into problems in some compilers when  identifier is longer than 31 characters.
  5. If you want You can choose any name as an identifier if you follow the above rule or c programing rule carefully , however, give meaningful names to identifiers that make sense. 

No comments:

Post a Comment