answersLogoWhite

0


Best Answer

User-defined names (whether variables or functions) must begin with a letter or an underscore (not a digit), and may contain any combination of letters, numbers and underscores, but no spaces or punctuation.

No name may be the same as a reserved word or keyword, but all names are case sensitive. So while return is a reserved word, Return and RETURN are not. However, it's best to avoid such ambiguities and come up with your own unique names.

Beyond that you are free to use any naming convention that makes sense to you, but ultimately your code must be readable. Variable names like i, j and k may seem obvious to you while you are hurriedly writing code, but next time you look at that code it somehow doesn't seem quite so obvious what i represents. Single letters are fine for looping purposes and temporary variables but even a short abbreviation can help clarify the exact purpose of a variable. The more self-explanatory a variable is, the more readable your code becomes.

It is quite common for constants to be all uppercase to give a visual reminder. However, there are other conventions you may encounter such as prefixing class member variables with m_ often followed by a short type identifier, such as m_iAge, to denote a member integer variable, or pszCaption to denote a null-terminated string. There are no rules on this regard, but whatever conventions you choose to use, use them consistently.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

13y ago

x, x_2 and _3s

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which of the following symbols can be used while naming a variable in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Rules in naming variables in programming?

there are various types of naming rule provide for function ,identifier,i.e variables.but naming rule for variable must meet certain condition.. 1.you can easily idenfy what is variable for.for eg.you may use int a;/to store no of student in your prog. but it is better instead of using "a",you can write any of the following definition int stu; or int stu_no; or int studentno; 2.it must be abbreviated.because although modern compiler support 32 char variable but still where you use that variable you have to type that name again &again. so for eg. in the above case int stu_no; is optimal. when these precondition are met then here are some rules for naming a variable: 1.you use only English alphabet,numeric no,& _(underscore). 2.you must start with a alphabet. then you continue with alphabet or numeric or under score.for eg. you can define a variable like int stu_comp_2009;//for no of student 2009 batch. 3.no variable can start with number or _.such naming may cause some compiler do the right job but maximum would not support this.


Three elements that must be included in order for a loop to successfully perform correctly?

Well, in C for example the while-loop looks like this:while (condition) statementThe following ones are all wrong:condition (while) statementwhile (statement) conditionstatement (condition) while...


How can you declare global and local variable in pseudocode?

A local variable is a variable declared inside a construct, such as a class or function, while a global variable is a variable declared outside of any construct.


Difference Between Variable And constant?

A constant and variable are variations of data types. int a; is a variable and its value can be changed by the program as the program runs. const int b; is a constant with a fixed value and will have its value set and may not be changed by the program as as the program runs. All data types may be declared as a constant. Variable Value Can Be Changed By You In Programme.


When do we use an address operator in c'?

In C we use & operator while giving address of some variable to some pointer variable. & operator is also used in scanf().

Related questions

Rules in naming variables in programming?

there are various types of naming rule provide for function ,identifier,i.e variables.but naming rule for variable must meet certain condition.. 1.you can easily idenfy what is variable for.for eg.you may use int a;/to store no of student in your prog. but it is better instead of using "a",you can write any of the following definition int stu; or int stu_no; or int studentno; 2.it must be abbreviated.because although modern compiler support 32 char variable but still where you use that variable you have to type that name again &again. so for eg. in the above case int stu_no; is optimal. when these precondition are met then here are some rules for naming a variable: 1.you use only English alphabet,numeric no,& _(underscore). 2.you must start with a alphabet. then you continue with alphabet or numeric or under score.for eg. you can define a variable like int stu_comp_2009;//for no of student 2009 batch. 3.no variable can start with number or _.such naming may cause some compiler do the right job but maximum would not support this.


Is a variable a verb?

No, it is not a verb. "A variable" is a noun, while "variable" is an adjective.


How is naming a ray similar or naming a line?

naming a line is different from naming a ray. say for example ,if we have line AB,this is similar to line BA while ray AB is different from ray BA.


Can you use sign while naming a file in windows?

no


Three elements that must be included in order for a loop to successfully perform correctly?

Well, in C for example the while-loop looks like this:while (condition) statementThe following ones are all wrong:condition (while) statementwhile (statement) conditionstatement (condition) while...


Can you use a percent sign while naming a file in Windows?

no


Which of the following best describes a manipulated variable?

Fifteen turtles are fed iceberg lettuce and vitamins, while another fifteen turtles are fed only iceberg lettuce


What two symbols did Seaborgs group produce and what are their symbols?

While seaborg was in charge of the group, the group discovered the following elements: plutonium (Pu), Americium (Am), curium (Cm), Berkelium (Bk), and Californium (Cf). While those are the elements that the group discovered while Seaborg was the head, in total, the group discovered all of the elements from #94-#103.


Would battery be the independent variable and flashlight dependent variable in an experiment?

Nope. Dependent Variable is the variable that is being tested/measured while Independent variable is the variable is that can be changed.


What variable does the X axis show?

It shows the independent variable while the Y axis shows the dependent variable


The relationship between dependent variable and independent variable?

A dependent variable depends on the other factors while an independent variable does not depend on the other factors.


What the difference between a variable and control?

The difference between a controlled variable and a variable is in their state. A controlled variable is something which is rigid and constant while a variable is liable to change and inconsistent.