By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,191 Members | 751 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,191 IT Pros & Developers. It's quick & easy.

c++

P: 1
what are rules for defining a variable in c-c++?
Mar 21 '07 #1
Share this Question
Share on Google+
3 Replies


Banfa
Expert Mod 5K+
P: 8,916
Only do it where it is legal.
Only give it a valid name.


May I suggest you read a text book (pretty much anyone would do) and variables will be one of the first things covered.
Mar 21 '07 #2

P: 60
1.The varirable name should not be the same asthe built in keywords.
2.It shoul not start with a numeric.
3.Some Compilers may allow you to declare a variable name with '_'(underscore)
as the first letter...
and many more like this
Mar 21 '07 #3

Roonie
P: 99
while it is legal to declare variables and functions beginning with an underscore, it is discouraged to do so . . . these are typically reserved for compile macros and functions. they use an underscore so that there is no conflict with any variables you might declare. the underscore keeps things seperate.
Mar 21 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.