Protec Computer Academy (An ISO 9001:2015 Certified Institute, Powered by E-Max Education, Branch Code EMAX/EK-80503, Registered by government of India.) is a best IT training center in Siwan with 100% Job placement assistance. Where you can learn Programming, WebDesigning, Hardware|Networking, Blogging, WordPress, Digitial marketing, English Speaking, And many more...| All certificates are valid in Government Jobs as well as in Private Companies. *** At Tara Market, Beside Vishal Mega Mart - Siwan*** +917541905230, Email- ahmad.irshad781@gmail.com *** Follow us on | | @welcome2protec

Saturday, March 28, 2020

Identifier in C

identifiers are the user defined name given to variables, functions, arrays etc. They are used to uniquely identify a program element.

Identifiers in C | welcome2protec.com


In the C language, identifiers are the user defined name given to variables, functions, arrays, structures, unions, labels, user defined data etc. They are used to uniquely identify a program element during the execution of the program in the code.

An identifier can be composed of letters such as uppercase, lowercase letters, underscore, digits, but the starting letter should be either an alphabet or an underscore.

Example of valid identifier:

int number, sum, average, _num1, sum_2;

Here, number, sum, average, _num1, sum_2 are valid identifiers of int type.

Note: Identifier names must be different from keywords. For example, you cannot use int as an identifier because int is a keyword.


Example of Invalid Identifiers:

int, char   // It cannot be valid identifiers because they are reserved words.
2nd_number  // Not valid, since an identifiers cannot be start with number 
total+1     // Not valid, since it cannot be special characters '+'

We can say that an identifier is a collection of alphanumeric characters that begins either with an alphabetical character or an underscore, which are used to represent various programming elements such as variables, functions, arrays, structures, unions, labels, etc. There are 52 alphabetical characters (uppercase and lowercase), underscore character, and ten numerical digits (0-9) that represent the identifiers. There is a total of 63 alphanumerical characters that represent the identifiers.


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
Lowecase: 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.


Rules for constructing C identifiers:

  • The first character of an identifier should be either an alphabet or an underscore, and then it can be followed by any of the character, digit, or underscore.
  • It should not begin with any numerical digit.
  • In identifiers, both uppercase and lowercase letters are distinct. Therefore, we can say that identifiers are case sensitive.
  • Commas or blank spaces cannot be specified within an identifier.
  • You cannot use keywords as an identifiers.
  • The length of the identifiers should not be more than 31 characters.
  • Identifiers should be written in such a way that it is meaningful, short, and easy to read.
  • Identifiers name must be unique.
  • You can choose any name as an identifier if you follow the above rule, however, give meaningful names to identifiers that make sense.











Protec Computer Academy (An ISO 9001:2015 Certified Institute, Powered by E-Max Education, Branch Code EMAX/EK-80503, Registered by government of India.) is a best IT training center in Siwan with 100% Job placement assistance. Where you can learn Programming, WebDesigning, Hardware|Networking, Blogging, WordPress, Digitial marketing, English Speaking, And many more...| All certificates are valid in Government Jobs as well as in Private Companies. *** At Tara Market, Beside Vishal Mega Mart - Siwan*** +966532621401, Email- ahmad.irshad781@gmail.com *** Follow us on | | @welcome2protec

Help others by sharing this page.

Ahmad Irshad

Author & Editor

I love blogging, teaching, learning computer science and sharing it to others. I've written and develped this site so that students may learn computer science related tutorials eaisly. MCA / MCITP

0 Comments:

Post a Comment

Please don't enter any spam link in the comment box.


Protec Computer Academy (An ISO 9001:2015 Certified Institute, Powered by E-Max Education, Branch Code EMAX/EK-80503, Registered by government of India.) is a best IT training center in Siwan with 100% Job placement assistance. Where you can learn Programming, WebDesigning, Hardware|Networking, Blogging, WordPress, Digitial marketing, English Speaking, And many more...| All certificates are valid in Government Jobs as well as in Private Companies. *** At Tara Market, Beside Vishal Mega Mart - Siwan*** +966532621401, Email- ahmad.irshad781@gmail.com *** Follow us on | | @welcome2protec
Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec Protec
Contact Us