c++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shahid76
    New Member
    • Mar 2007
    • 1

    #1

    c++

    what are rules for defining a variable in c-c++?
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    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.

    Comment

    • palani12kumar
      New Member
      • Oct 2006
      • 60

      #3
      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

      Comment

      • Roonie
        New Member
        • Mar 2007
        • 99

        #4
        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.

        Comment

        Working...