: Thanks for the reply. I do have one other question to help clarify something for me.
:
: : : What is the difference between using "const" and "#define"?
: : :
: : #define is just for preprocessor text substitution. Has nothing to do with const.
:
: So, when would one use something like
:
: #define CPUSTRING "Intel - x86"
:
: versus
:
: const char CPUSTRING = "Intel - x86";
:
: ? CPUSTRING is a const char in either case, right?
:
Not necessarily. If you use the define, you could write
const char stuff[] = CPUSTRING;
or
char stuff[] = CPUSTRING;
In the first instance, it would indeed be a const char array, but not in the second case. Again, const is only really useful if you're going to rom the application, for example in an embedded system. For PC apps, it doesn't make any difference, except that the compiler may complain about lack of type casting.
The statement
const char CPUSTRING = "Intel - x86";
will give you a compiler error.