چه کسانی این کتاب را می‌خوانند

دانشجوعلاقه‌مند یادگیری
کتابخوان حرفه‌ایلذت مطالعه
نویسندهالهام‌گیری

Head First C : A Brain-Friendly Guide

David Griffiths, Dawn Griffiths, David Griffiths

قیمت نهایی

۴۰٬۰۰۰ تومان۴۹٬۰۰۰ تومان۱۸٪ تخفیف
  • تخفیف زمان‌دار−۹٬۰۰۰ تومان

۹٬۰۰۰ تومان صرفه‌جویی نسبت به قیمت اصلی

بلافاصله پس از خرید، فایل کتاب روی دستگاه شما آمادهٔ دانلود است.

تحویل فوری
پرداخت امن
ضمانت فایل
پشتیبانی

نسخه اصلی و اورجینال

فایل دیجیتال کامل و بدون دستکاری — همان نسخه‌ای که پس از خرید دریافت می‌کنید.

مشخصات کتاب

سال انتشار
۲۰۱۲
فرمت
PDF
زبان
انگلیسی
حجم فایل
۴۳٫۲ مگابایت
شابک
9781449335649، 9781449335656، 9781449345013، 9781449399917، 1449335640، 1449335659، 1449345018، 1449399916

دربارهٔ کتاب

Author Interview with David & Dawn Griffiths What made you write the book? There are already great C books, but many of them are pretty hard for a new developer to understand. Many of the existing books were written several years ago when people were still focused on memory and chips and assembly language. That's not the case any more and we felt that the world was ready for a modern introduction to C. Why is your book especially important now? Because C is still hugely popular. Tiobe currently list C as the second most popular language after Java; langpop.com list it as the most popular language in the world. In the last few years, the number of platforms has increased dramatically. People don't just use desktop Windows machines any more. There are tablets, phones, and even custom Arduino devices. People are hacking Linux. Makers are building things to do who-knows-what and all of these platforms have one thing in common: they have applications written in C, or use languages that are based on C. The first thing that normally happens when a new platform is created is someone builds a C compiler for it. This book teaches people how to make the most of that. What is the single most important thing readers will be able to do after reading your book? Head First C takes you deeply into how memory and pointers work and how to avoid the pitfalls. That sounds like a small thing, and for most languages memory-use is not a big issue. But things like memory-pointers are a huge stumbling block for new C programmers. We teach the ways that array variables are like pointer variables, and the ways that they are very different. We take you on a journey through the stack and the heap. Show you how literals work. We even show you how to use advanced tools like valgrind to track down and fix memory problems in your code. In a fundamental way, if you understand how C uses memory, then you understand C. Who is your intended audience? Really anybody who's new to C, whether they're writing Linux code, or programming Arduino. But our primary audience is college students who are building their first C projects. C is popular in colleges because it's such a foundational subject. But if you're suddenly thrust into an introductory C course and you start to have problems with the code, where do you go? What do you think is on the horizon for your readers? C is important because it gives you a much more fundamental understanding of how the computer works. If you really understand C, you will be more equipped to learn other languages. If you know C, you can become a better Java programmer. If you learn C, you will have a better understanding of how Python works. Once you learn C, you have the foundations in place to, say, program games in C++, or write code in Objective C that will make the most of the hardware on the iPhone or iPad. Or to enter the world of open source development on Linux. C is an entry point to a whole other level of development. Table of Contents (Summary) Table of Contents (the real thing) Intro Who is this book for? We know what you’re thinking We know what your brain is thinking Metacognition: thinking about thinking Here’s what WE did: Here’s what YOU can do to bend your brain into submission Read me The technical review team Acknowledgments Safari® Books Online Chapter 1: Getting Started with C: Diving in C is a language for small, fast programs But what does a complete C program look like? But how do you run the program? Two types of command Here’s the code so far Card counting? In C? There’s more to booleans than equals... What’s the code like now? Pulling the ol’ switcheroo Sometimes once is not enough... Loops often follow the same structure... You use break to break out... Your C Toolbox Chapter 2: Memory and Pointers: What are you pointing at? C code includes pointers Digging into memory Set sail with pointers Set sail sou’east, Cap’n Try passing a pointer to the variable Using memory pointers How do you pass a string to a function? Array variables are like pointers... What the computer thinks when it runs your code But array variables aren’t quite pointers Why arrays really start at 0 Why pointers have types Using pointers for data entry Be careful with scanf() fgets() is an alternative to scanf() Anyone for three-card monte? Oops...there’s a memory problem... String literals can never be updated In memory: char *cards=“JQK”; If you’re going to change a string, make a copy In memory: char cards[]=“JQK”; Memory memorizer Your C Toolbox Chapter 2.5: Strings: String theory Desperately seeking Frank Create an array of arrays Find strings containing the search text Using the strstr() function It’s time for a code review Array of arrays vs. array of pointers Your C Toolbox Chapter 3: Creating Small Tools: Do one thing and do it well Small tools can solve big problems Here’s how the program should work But you’re not using files... You can use redirection You can redirect the Standard Input with But there’s a problem with some of the data... Introducing the Standard Error By default, the Standard Error is sentto the display fprintf() prints to a data stream Let’s update the code to use fprintf() Small tools are flexible Don’t change the geo2json tool A different task needs a different tool Connect your input and output with a pipe The bermuda tool But what if you want to output tomore than one file? Roll your own data streams There’s more to main() Overheard at the Head First Pizzeria Let the library do the work for you Your C Toolbox Chapter 4: Using Multiple Source Files: Break it down, build it up Your quick guide to data types Don’t put something big into something small Use casting to put floats into whole numbers Oh no...it’s the out-of-work actors... Let’s see what’s happened to the code Compilers don’t like surprises Split the declaration from the definition Creating your first header file If you have common features... You can split the code into separate files Compilation behind the scenes The shared code needs its own header file It’s not rocket science...or is it? Don’t recompile every file First, compile the source into object files It’s hard to keep track of the files Automate your builds with the make tool How make works Tell make about your code with a makefile Liftoff! Your C Toolbox C Lab 1: Arduino The spec: make your houseplant talk Build the physical device Here’s what your code should do Here are some useful Arduino functions The finished product Chapter 5: Structs, Unions, and Bitfields: Roll your own structures Sometimes you need to hand around a lot of data Cubicle conversation Create your own structured data types with a struct Just give them the fish Read a struct’s fields with the “.” operator Can you put one struct inside another? How do you update a struct? The code is cloning the turtle You need a pointer to the struct (*t).age vs. *t.age Sometimes the same type of thing needs different types of data A union lets you reuse memory space How do you use a union? An enum variable stores a symbol Sometimes you want control at the bit level Bitfields store a custom number of bits Your C Toolbox Chapter 6: Data Structures and Dynamic Memory: Building bridges Do you need flexible storage? Linked lists are like chains of data Linked lists allow inserts Create a recursive structure Create islands in C... Inserting values into the list Use the heap for dynamic storage Give the memory back when you’re done Ask for memory with malloc()... Oh, no! It’s the out-of-work actors... Let’s fix the code using the strdup() function Free the memory when you’re done Exhibit A: the source code An overview of the SPIES system Software forensics: using valgrind Use valgrind repeatedly to gather more evidence Look at the evidence The fix on trial Your C Toolbox Chapter 7: Advanced Functions: Turn your functions up to 11 Looking for Mr. Right... Pass code to a function You need to tell find() the name of a function Every function name is a pointer to the function... ...but there’s no function data type How to create function pointers Get it sorted with the C Standard Library Use function pointers to set the order Automating the Dear John letters Create an array of function pointers Make your functions streeeeeetchy Your C Toolbox Chapter 8: Static and Dynamic Libraries: Hot-swappable code Code you can take to the bank Angle brackets are for standard headers But what if you want to share code? Sharing .h header files Share .o object files by using the full pathname An archive contains .o files Create an archive with the ar command... Finally, compile your other programs The Head First Gym is going global Calculating calories But things are a bit more complex... Programs are made out of lots of pieces... Dynamic linking happens at runtime Can you link .a at runtime? First, create an object file What you call your dynamic library depends on your platform Your C Toolbox C Lab 2: OpenCV The spec: turn your computer into an intruder detector What your code should do The finished product Chapter 9: Processes and System Calls: Breaking boundaries System calls are your hotline to the OS Then someone busted into the system... Security’s not the only problem The exec() functions give you more control There are many exec() functions The array functions: execv(), execvp(), execve() Passing environment variables Most system calls go wrong in the same way Read the news with RSS exec() is the end of the line for your program Running a child process with fork() + exec() Your C Toolbox Chapter 10: Interprocess Communication: It's good to talk Redirecting input and output A look inside a typical process Redirection just replaces data streams fileno() tells you the descriptor Sometimes you need to wait... Stay in touch with your child Connect your processes with pipes Case study: opening stories in a browser In the child In the parent Opening a web page in a browser The death of a process Catching signals and running your own code sigactions are registered with sigaction() Rewriting the code to use a signal handler Use kill to send signals Sending your code a wake-up call Your C Toolbox Chapter 11: Sockets and Networking: There's no place like 127.0.0.1 The Internet knock-knock server Knock-knock server overview BLAB: how servers talk to the Internet A socket’s not your typical data stream Sometimes the server doesn’t start properly Why your mom always told you to check for errors Reading from the client The server can only talk to one person at a time You can fork() a process for each client Writing a web client Clients are in charge Create a socket for an IP address getaddrinfo() gets addresses for domains Your C Toolbox Chapter 12: Threads: It's a parallel world Tasks are sequential...or not... ...and processes are not always the answer Simple processes do one thing at a time Employ extra staff: use threads How do you create threads? Create threads with pthread_create The code is not thread-safe You need to add traffic signals Use a mutex as a traffic signal Your C Toolbox C Lab 3: Blasteroids Write the arcade game Blasteroids Your mission: blast the asteroids without getting hit Allegro What does Allegro do for you? Building the game The spaceship The blast The asteroid The game status Use transformations to move things around The finished product Leaving town... It’s been great having you here in Cville! Appendix i: Leftovers: The top ten things (we didn't cover) #1. Operators #2. Preprocessor directives #3. The static keyword #4. How big stuff is #5. Automated testing #6. More on gcc #7. More on make #8. Development tools #9. Creating GUIs #10. Reference material Appendix ii: C Topics: Revision roundup Basics Pointers and memory Strings Data streams Data types Multiple files Structs Unions and bitfields Data structures Dynamic memory Advanced functions Static and dynamic libraries Processes and communication Sockets and networking Threads Index Ever wished you could learn C from a book? Head First C provides a complete learning experience for C and structured imperative programming. With a unique method that goes beyond syntax and how-to manuals, this guide not only teaches you the language, it helps you understand how to be a great programmer. You'll learn key areas such as language basics, pointers and pointer arithmetic, and dynamic memory management. Advanced topics include multi-threading and network programming—topics typically covered on a college-level course.This book also features labs: in-depth projects intended to stretch your abilities, test your new skills, and build confidence. Head First C mimics the style of college-level C courses, making it ideal as an accessible textbook for students.We think your time is too valuable to waste struggling with new concepts. Using the latest research in cognitive science and learning theory to craft a multi-sensory learning experience, Head First C uses a visually rich format designed for the way your brain works, not a text-heavy approach that puts you to sleep. Ever wished you could learn C from a book? Head First C provides a complete learning experience for C and structured imperative programming. With a unique method that goes beyond syntax and how-to manuals, this guide not only teaches you the language, it helps you understand how to be a great programmer. You'll learn key areas such as language basics, pointers and pointer arithmetic, and dynamic memory management. Advanced topics include multi-threading and network programming—topics typically covered on a college-level course. This book also features labs: in-depth projects intended to stretch your abilities, test your new skills, and build confidence. Head First C mimics the style of college-level C courses, making it ideal as an accessible textbook for students. We think your time is too valuable to waste struggling with new concepts. Using the latest research in cognitive science and learning theory to craft a multi-sensory learning experience, Head First C uses a visually rich format designed for the way your brain works, not a text-heavy approach that puts you to sleep. Getting started with C : diving in Memory and pointers : what are you pointing at? Strings : string theory Creating small tools : do one thing and do it well Using multiple source files : break it down, build it up C Lab 2 : Arduino Structs, unions, and bitfields : rolling your own structures Data structures and dynamic memory : building bridges Advanced functions : turn your functions up to 11 Static and dynamic libraries : hot-swappable code C Lab 2 : OpenCV Processes and system calls : breaking boundaries Interprocess communication : it's good to talk Sockets and networking : there's no place like 127.0.0.1 Threads : it's a parallel world C Lab 3 : Blasteroids Leftovers : the top ten things (we didn't cover) C topics : revision roundup. "A brain-friendly guide"--Cover. - Includes bibliographical references (p. 552) and index. - Description based on print version record

قیمت نهایی

۴۰٬۰۰۰ تومان