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

Is number and NuMber identical

P: n/a
Is there any validation on character case as well in C++
Sep 28 '10 #1
Share this Question
Share on Google+
3 Replies


weaknessforcats
Expert Mod 5K+
P: 9,197
Everything in C++ is case-sensitive.
Sep 28 '10 #2

Frinavale
Expert Mod 5K+
P: 9,731
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
Sep 28 '10 #3

Expert 100+
P: 2,400
It depends on what they are. For example, in this case they are indeed identical and interchangeable:
Expand|Select|Wrap|Line Numbers
  1. #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.
Expand|Select|Wrap|Line Numbers
  1. int NumBer = 4;
  2. 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.
Sep 28 '10 #4

Post your reply

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