Identifiers in c

Identifiers in c

C identifiers , All the words we will use in the C language will be either keywords or identifiers. The keywords are predefined words that cannot changed by the users and C Identifiers are user defined words and are use to give names to entities like variables, functions, array, structures, union etc. Rules for Naming identifiers giving—-

C identifiers represent the name in the C language, for example, functions, arrays, structures variables, labels unions, etc. it is a composed of letters such as lowercase, uppercase letters, digits and underscore, but the starting letter should be either an alphabet or an underscore not the any digit. If identifiers not used in the external linkage, then it is known as an internal identifier. and whenever the identifier is used in the external linkage, then it is known as an external identifier.

The Rules for Naming C Identifiers are giving below-

(1)The name should consist of only uppercase. lowercase, digits and underscore(_).
(2).The name should not be a keyword(reserve word)
(3).The first character should be an alphabet or underscore.
(4). Commas or blank spaces cannot be specified within an identifier.
(5).It should not start with any numerical digit.
(6) The length of the identifier should not be more than 31 characters.
(7).The C is a case sensitive. so the lowercase and uppercase considering different so for example program and PROGRAM are different.

Some valid Identifiers examples are

     number          Amount_pay     reg1    _data     AVERAGE

Some Invalid Identifiers examples are-

     6number          int     reg#    4data     AVERAGE no

Difference between C Identifiers and keywords-

Identifiers Keywords
Identifiers are the user defined words Keywords are the pre-defined words. That have a special meaning
It can be written in both case lowercase and uppercase It must be written in a lowercase letter
It can contain underscore, number, characters It does not contain the underscore character and numbers
Data type Size
int or signed int 2 byte
unsigned int 2 byte
short int or signed short int 1 byte
unsigned short int 1 byte
short int or signed short int 1 byte
long int or signed long int 4 byte
unsigned long int 4 byte
float 4 byte
double 8 byte
long double 10 byte

#include<stdio.h>
int main()
{
int a=15;
int b=30;
printf("Value of a is : %d",a);
printf("\nValue of b is :%d",b);
return 0;
}

Value of a is : 15
Value of b is :30