Chapter03 -...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Viewing Hints  ] [  Exercise Solutions  ] [  Volume 2  ] [  Free Newsletter  ]  Seminars  ] [  Seminars on CD ROM  ] [  Consulting  ]  Thinking in C++, 2nd ed. Volume 1 © 2000 by Bruce Eckel Previous Chapter  ] [  Table of Contents  ] [  Index  ] [  Next Chapter  ]  3: The C in C++ Since C++ is based on C, you must be familiar with the syntax of C in order to  program in C++, just as you  must be reasonably fluent in algebra in order to tackle calculus. If you’ve never seen C before, this chapter will give you a decent background in the style of C used  in C++. If you are familiar with the style of C described in the first edition of Kernighan & Ritchie  (often called K&R C), you will find some new and different features in C++ as well as in Standard  C. If you are familiar with Standard C, you should skim through this chapter looking for features  that are particular to C++. Note that there are some fundamental C++ features introduced here,  which are basic ideas that are akin to the features in C or often modifications to the way that C does  things. The more sophisticated C++ features will not be introduced until later chapters. This chapter is a fairly fast coverage of C constructs and introduction to some basic C++ constructs,  with the understanding that you’ve had some experience programming in another language. A more  gentle introduction to C is found in the CD ROM packaged in the back of this book, titled  Thinking  in C: Foundations for Java & C++  by Chuck Allison (published by MindView, Inc., and also available  at www.MindView.net). This is a seminar on a CD ROM with the goal of taking you carefully  through the fundamentals of the C language. It focuses on the knowledge necessary for you to be  able to move on to the C++ or Java languages rather than trying to make you an expert in all the  dark corners of C (one of the reasons for using a higher-level language like C++ or Java is precisely  so we can avoid many of these dark corners). It also contains exercises and guided solutions. Keep  in mind that because this chapter goes beyond the  Thinking in C  CD, the CD is not a replacement for  this chapter, but should be used instead as a preparation for this chapter and for the book. Creating functions In old (pre-Standard) C, you could call a function with any number or type of arguments and the  compiler wouldn’t complain. Everything seemed fine until you ran the program. You got mysterious  results (or worse, the program crashed) with no hints as to why. The lack of help with argument 
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern