[ Viewing Hints ] [ Book Home Page ] [ Free Newsletter ] [ Seminars ] [ Seminars on CD ROM ] [ Consulting ] Annotated Solution Guide Revision 1.0 for Thinking in C++, 2nd edition, Volume 1by Chuck Allison ? 2001 MindView, Inc. All Rights Reserved.[ Previous Chapter ] [ Table of Contents ] [ Next Chapter ] Chapter 88-1Create three constintvalues, then add them together to produce a value that determines the size of an array in an array definition. Try to compile the same code in C and see what happens (you can generally force your C++ compiler to run as a C compiler by using a command-line flag). (Left to the reader) 8-2Prove to yourself that the C and C++ compilers really do treat constants differently. Create a global const and use it in a global constant expression; then compile it under both C and C++. Solution://: S08:GlobalConst.cppconstint n = 100; constint m = n + 2; int main() { } ///:~While this is a legal C++ program, C doesn’ t allow expressions with const variables at the global level, so the above code will not compile in C. If you move the declaration of m inside of main( ), however, it works fine in C. But don’ t let this make you think that you can do this for array declarations. Exercise 1 shows that you cannot use a const variable as an array dimension in C under any circumstances. 8-3Create example const definitions for all the built-in types and their variants. Use these in expressions with other consts to make new constdefinitions. Make sure they compile successfully. (Left to the reader) 8-4Create a const definition in a header file, include that header file in two .cpp files, then compile those files and link them. You should not get any e...