A variable is an entity whose value keeps on changing throughout the program execution. As we all know, data is stored in the memory of the computer. Actually, data is not stored in the variable. A variable is the name given to the memory location. A variable name is an entity that points to a particular memory location.
Variable can be of different types.
Rules for constructing variable names
1) A Variable name consists of any combination of alphabets, digits and underscores. Some compiler allows variable names whole length could be up to 247 characters. Still it would be safer to stick to the rule of 31 characters. Please avoid creating long variable name as it adds to your typing effort.
2) The first character of the variable name must either be alphabet or underscore. It should not start with the digit.
3) No commas and blanks are allowed in the variable name.
4) No special symbols other than underscore are allowed in the variable name.
We need to declare the type of the variable name before making use of that name in the program. Type declaration can be done as follows:
To declare a variable as integer, follow the below syntax:
int variable_name;
Here int is the type of the variable named variable_name. ‘int’ denotes integer type.
Following are the examples of type declaration statements:
E.g.: int p, n;
float r;
Labels:
Rules for Constructing Variable Names in C Language
Variable can be of different types.
Rules for constructing variable names
1) A Variable name consists of any combination of alphabets, digits and underscores. Some compiler allows variable names whole length could be up to 247 characters. Still it would be safer to stick to the rule of 31 characters. Please avoid creating long variable name as it adds to your typing effort.
2) The first character of the variable name must either be alphabet or underscore. It should not start with the digit.
3) No commas and blanks are allowed in the variable name.
4) No special symbols other than underscore are allowed in the variable name.
We need to declare the type of the variable name before making use of that name in the program. Type declaration can be done as follows:
To declare a variable as integer, follow the below syntax:
int variable_name;
Here int is the type of the variable named variable_name. ‘int’ denotes integer type.
Following are the examples of type declaration statements:
E.g.: int p, n;
float r;
Responses
5 Respones to "Rules for Constructing Variable Names in C Language"
Thank You it is very useful :)
March 24, 2017 at 7:04 PM
Useful
June 22, 2018 at 7:43 AM
It has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted.occupational health and safety course in chennai
November 18, 2018 at 9:44 PM
Thank you for sharing information with us.
To Get Adimission in BMS Collehe Of ENgineering, Visit Our Website
Bms College of Engineering Admission | Bms Bangalore Admission 2019 | Bms College of Engineering Bangalore Admission | Bms School of Architecture Admissions | Bms College of Engineering Bangalore | Bms College of Engineering Bangalore Management Quota fees | Bms College of Engineering Fee Structure For Btech | Bms College of Engineering Management Quota Fee Structure | Bms College of Engineering Bangalore Fee Structure | Bms College Management Quota Fees | Bms Engineering College Fees
April 11, 2019 at 11:21 PM
Post a Comment