Ask your own question, for FREE!
Computer Science 24 Online
OpenStudy (anonymous):

List the rules to keep in mind as you declare a variable

OpenStudy (anonymous):

which language ?

OpenStudy (anonymous):

It doesnt say

OpenStudy (anonymous):

Then it is difficult to answer,as it differs from language to language ...

OpenStudy (anonymous):

Just do any language

OpenStudy (anonymous):

Rules for constructing variable names in C: 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; FROM HERE: http://www.learnconline.com/2010/03/types-of-c-variables.html

OpenStudy (razor):

1. Make sure it has only allowed character 2. Choose a name that make sense instead of single alphabet ones. 3. Be sure not to use keywords that is reserved. 4. If the variable name is (for some reason) not self explanatory, comment it. 5. Try not to use Unicode-characters on language that supports them. Not everyone has 'öäü 'or some Japanese alphabet on their keyboard.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!