C Primer Plus (6th Edition) (Developer's Library)

C Primer Plus (6th Edition) (Developer's Library)

Language: English

Pages: 1080

ISBN: 0321928423

Format: PDF / Kindle (mobi) / ePub

C Primer Plus is a carefully tested, well-crafted, and complete tutorial on a subject core to programmers and developers. This computer science classic teaches principles of programming, including structured code and top-down design.


Author and educator Stephen Prata has created an introduction to C that is instructive, clear, and insightful. Fundamental programming concepts are explained along with details of the C language. Many short, practical examples illustrate just one or two concepts at a time, encouraging readers to master new topics by immediately putting them to use.


Review questions and programming exercises at the end of each chapter bring out the most critical pieces of information and help readers understand and digest the most difficult concepts. A friendly and easy-to-use self-study guide, this book is appropriate for serious students of programming, as well as developers proficient in other languages with a desire to better understand the fundamentals of this core language.


The sixth edition of this book has been updated and expanded to cover the latest developments in C as well as to take a detailed look at the new C11 standard. In C Primer Plus you’ll find depth, breadth, and a variety of teaching techniques and tools to enhance your learning:


  • Complete, integrated discussion of both C language fundamentals and additional features
  • Clear guidance about when and why to use different parts of the language
  • Hands-on learning with concise and simple examples that develop your understanding of a concept or two at a time
  • Hundreds of practical sample programs
  • Review questions and programming exercises at the end of each chapter to test your understanding
  • Coverage of generic C to give you the greatest flexibility















enables you to use files instead of the keyboard and screen for input and output. Programs that read input up to EOF can then be used either with keyboard input and simulated end-of-file signals or with redirected files. Interspersing calls to getchar() with calls to scanf() can cause problems when scanf() leaves a newline character in the input just before a call to getchar(). By being aware of this problem, however, you can program around it. When you are writing a program, plan the user

the same as the append file, skip to the next file. If it cannot be opened in the read mode, skip to the next file. Add the contents of the file to the append file. For a grand finale, the program rewinds the append file to the beginning and displays the contents. For practice, we’ll use fread() and fwrite() for the copying. Listing 13.5 shows the result. Listing 13.5 The append.c Program Click here to view code image * * * /* append.c -- appends files to a file */ #include

That is, the command scanf("%c", &ch) reads the first character encountered in input, and scanf(" %c", &ch) reads the first non-whitespace character encountered. The scanf() Return Value The scanf() function returns the number of items that it successfully reads. If it reads no items, which happens if you type a nonnumeric string when it expects a number, scanf() returns the value 0. It returns EOF when it detects the condition known as “end of file.” (EOF is a special value defined in the

Click here to view code image flour = (25.0 + 60.0 * n) / SCALE; Whatever is enclosed in parentheses is executed first. Within the parentheses, the usual rules hold. For this example, first the multiplication takes place and then the addition. That completes the expression in the parentheses. Now the result can be divided by SCALE. Table 5.1 summarizes the rules for the operators used so far. (The inside back cover of this book presents a table covering all operators.) Table 5.1 Operators in

will be easy to modify and easy to adapt to new models of computers. Figure 1.2 Where C is used. What’s good for companies and C veterans is good for other users, too. More and more computer users have turned to C to secure its advantages for themselves. You don’t have to be a computer professional to use C. In the 1990s, many software houses began turning to the C++ language for large programming projects. C++ grafts object-oriented programming tools to the C language. (Object-oriented

Download sample