In this blog.....
IDENTIFIER explanation |
Rules for forming identifier |
some valid identifier |
some invalid identifier |
eg with program |
IDENTIFIERS explanation in c
so what are identifiers , as from the name you can tell that it is some where used in identify data or object , so what i mean by object here is (functions name ,variables name )
so you can say that it is just method of giving meaning full name to object so that when you read your code again you are able to identify the use of that variable or function in your program.....
so what are identifiers , as from the name you can tell that it is some where used in identify data or object , so what i mean by object here is (functions name ,variables name )
so you can say that it is just method of giving meaning full name to object so that when you read your code again you are able to identify the use of that variable or function in your program.....
Rules for forming identifier
1.) identifier cannot contain any special characters except underscore (eg :- n@me is invalid but phn_no is valid ) .
2.) identifier cannot contain 2 succesive underscore (eg :- phn__no is invalid ) .
3.) keywords (special meaning word) cannot be used as identifier (eg int is invalid) .
4.) identifier can only begin with alphabets or underscore but it is recommended that it should begin only with alphabets because there are some compiler predefined identifier starting with underscore which can cause conflict in your program . (eg:- 2_no is invalid)
5.) identifier can be of max length 31 but if it is longer than 31 then only first 31 characters are considered .
1.) identifier cannot contain any special characters except underscore (eg :- n@me is invalid but phn_no is valid ) .
2.) identifier cannot contain 2 succesive underscore (eg :- phn__no is invalid ) .
3.) keywords (special meaning word) cannot be used as identifier (eg int is invalid) .
4.) identifier can only begin with alphabets or underscore but it is recommended that it should begin only with alphabets because there are some compiler predefined identifier starting with underscore which can cause conflict in your program . (eg:- 2_no is invalid)
5.) identifier can be of max length 31 but if it is longer than 31 then only first 31 characters are considered .
some valid identifiers
phn_no , roll_no , Roll_no , vehicle_no
phn_no , roll_no , Roll_no , vehicle_no
some invalid identifiers
2noriay , n@me , roll__no(2 successive underscore)
2noriay , n@me , roll__no(2 successive underscore)
program eg
(Note :- roll_no and Roll_no are 2 different identifiers ,as c is case sensitive )
(leave the comment down below if you have a doubt or suggestions ,thnks🙂)
No comments:
Post a Comment