IDENTIFIERS


IDENTIFIERS

"Identifiers" or "symbols" are the user-defined names supplied for variables, data types, functions, and labels in your program. Identifier names must differ in spelling and case from any keywords. You create an identifier by specifying it in the declaration of a variable, type, or function. Once declared, you can use the identifier in later program statements to refer to the associated value. Both uppercase and lowercase letters are permitted. The underscore character 
( _ ) is also permitted in identifiers to link two words. The name of a variable is an identifier.

Eg:-     #include<stdio.h>
#include<conio.h>
            void main()
            {
                        int a=10,b=21,result;
                        result=a+b;
                        printf(“sum=%d”,c);
            }
In this example, result is an identifier for an integer variables, and main and printf are identifier names for functions.

Rules for Identifiers:
1. First character must be an alphabet (or underscore)
2. Identifier names must consists of only letters, digits and underscore.
3. A identifier name should have less than 31 characters.
4. Any standard C language keyword cannot be used as a variable name.
5. An single identifier should not contain a space.


No comments:

Post a Comment