Is number and NuMber identical

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Richa Chhabra

    Is number and NuMber identical

    Is there any validation on character case as well in C++
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Everything in C++ is case-sensitive.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      Just in case you didn't understand the point that weaknessforcats was trying to make...

      No, number and NuMber are not identical because everything in C++ is case-sensitive.

      -Frinny

      Comment

      • donbock
        Recognized Expert Top Contributor
        • Mar 2008
        • 2427

        #4
        It depends on what they are. For example, in this case they are indeed identical and interchangeable :
        Code:
        #define NumBer number
        It depends on what you mean by identical. For example, in this case they are separate and distinct variables that happen to have the same [identical] value.
        Code:
        int NumBer = 4;
        int number = 4;
        Please provide a little more background about your question.

        To answer your inline question: neither C nor C++ validate names. You give a name and the compiler looks it up in an internal table. The lookup is case sensitive. The lookup either succeeds or fails; the compiler has no way to tell that you really meant to give a different name.

        On the other hand, filenames might be case-insensitive depending on the operating system. In this case, the compiler doesn't look up the [file]name; instead it passes the filename to the operating system. It is the operating system that looks up the filename. DOS and Windows have case-insensitive filenames; UNIX has case-sensitive filenames.

        Comment

        Working...