C Programming Pocket Primer: An Essential Guide to C Programming Basics
()
Mercury Learning and Information
MERCURY LEARNING and INFORMATION publishes content in the areas of science and medicine, technology and computing, engineering, and mathematics designed for the professional/reference, trade, library, higher education, career school, and online training markets.
Read more from Mercury Learning And Information
Python Data Structures Pocket Primer: A concise guide to Python data structures to enhance your skills Rating: 0 out of 5 stars0 ratingsTensorFlow 2 Pocket Primer: A Quick Reference Guide for TensorFlow 2 Developers Rating: 0 out of 5 stars0 ratingsAngular and Deep Learning Pocket Primer: A Comprehensive Guide to AI and Expert Systems for Professionals Rating: 0 out of 5 stars0 ratingsAngular and Machine Learning Pocket Primer: A Comprehensive Guide to Angular and Integrating Machine Learning Rating: 0 out of 5 stars0 ratingsPython 3 and Data Analytics Pocket Primer: A Quick Guide to NumPy, Pandas, and Data Visualization Rating: 0 out of 5 stars0 ratingsPython for TensorFlow Pocket Primer: A Quick Guide to Python Libraries for TensorFlow Developers Rating: 0 out of 5 stars0 ratings
Related to C Programming Pocket Primer
Related ebooks
Mastering C: A Comprehensive Guide to Proficiency in The C Programming Language Rating: 0 out of 5 stars0 ratingsC Programming For Dummies Rating: 0 out of 5 stars0 ratingsC Programming: Core Concepts and Techniques Rating: 0 out of 5 stars0 ratingsCodeCraft C: Mastering C Basics: C language, #1 Rating: 0 out of 5 stars0 ratingsC Programming Language, A Step By Step Beginner's Guide To Learn C Programming In 7 Days. Rating: 4 out of 5 stars4/5C Programming Language Rating: 0 out of 5 stars0 ratingsBeginning Programming with C For Dummies Rating: 0 out of 5 stars0 ratingsC Is for Children: My First Thirty-Two Keywords Rating: 0 out of 5 stars0 ratingsComputer Programming In C Language Rating: 4 out of 5 stars4/5C Programming: C Programming Language for beginners, teaching you how to learn to code in C fast! Rating: 0 out of 5 stars0 ratingsC Programming Rating: 0 out of 5 stars0 ratingsC in 30 Pages Rating: 5 out of 5 stars5/5Mastering C: Advanced Techniques and Best Practices Rating: 0 out of 5 stars0 ratingsNavigating the Worlds of C and C++: Masters of Code Rating: 0 out of 5 stars0 ratingsC All-in-One Desk Reference For Dummies Rating: 5 out of 5 stars5/5C Programming For Beginners: The Simple Guide to Learning C Programming Language Fast! Rating: 5 out of 5 stars5/5C Programming Concepts Rating: 0 out of 5 stars0 ratingsMastering the Craft of C Programming: Unraveling the Secrets of Expert-Level Programming Rating: 0 out of 5 stars0 ratingsBeginning Programming with C++ For Dummies Rating: 0 out of 5 stars0 ratingsC++ Step by Step: A Practical Guide with Examples Rating: 0 out of 5 stars0 ratingsC Programming Language Essentials Rating: 4 out of 5 stars4/5C Clearly - Programming With C In Linux and On Raspberry Pi Rating: 0 out of 5 stars0 ratingsBasic Information About C language PDF Rating: 0 out of 5 stars0 ratingsMastering System Programming with C: Files, Processes, and IPC Rating: 0 out of 5 stars0 ratingsLearning C Doesn't Make You a Dinosaur: A Beginner's Guide to C Rating: 0 out of 5 stars0 ratings"C Programming for Beginners: A Step-by-Step Guide" Rating: 0 out of 5 stars0 ratingsA Day in Code: An illustrated story written in the C programming language Rating: 0 out of 5 stars0 ratingsComputer Programming Using C Rating: 0 out of 5 stars0 ratingsAn Introduction to C & GUI Programming Rating: 0 out of 5 stars0 ratings
Programming For You
Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5PYTHON PROGRAMMING Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5JavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Python for Data Science For Dummies Rating: 0 out of 5 stars0 ratingsPython Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5Microsoft Azure For Dummies Rating: 0 out of 5 stars0 ratingsLearn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5Python Data Structures and Algorithms Rating: 5 out of 5 stars5/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5Learn SQL in 24 Hours Rating: 5 out of 5 stars5/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Beginning Programming with C++ For Dummies Rating: 4 out of 5 stars4/5Algorithms For Dummies Rating: 4 out of 5 stars4/5Beginning Programming with Python For Dummies Rating: 3 out of 5 stars3/5
Reviews for C Programming Pocket Primer
0 ratings0 reviews
Book preview
C Programming Pocket Primer - Mercury Learning and Information
PREFACE
WHAT IS THE GOAL?
The goal of this book is to introduce advanced beginners to C programming fundamentals. Hence, the material is primarily for people who have some programming experience, and not really suitable for absolute beginners.
This book is suitable as a fast-paced introduction to various core
features of C. The purpose of the material in the chapters is to illustrate how to solve a variety of tasks using C, after which you can do further reading to deepen your knowledge.
There is one other point to remember as you read this book: this book will not make you an expert programmer in C.
IS THIS BOOK IS FOR ME AND WHAT WILL I LEARN?
This book is intended for beginner to intermediate
programmers with a year or two of experience in another language who wish to learn C. You need some familiarity with working from the command line in a Unix-like environment. However, there are subjective prerequisites, such as a strong desire to learn how to write C programs, along with the motivation and discipline to read and understand the code samples.
If you are adequately prepared and motivated, you will learn how to write C programs that involve various C data types, loops, conditional logic, built-in functions, custom functions, and recursion.
This book saves you the time required to search for relevant code samples, adapting them to your specific needs, which is a potentially time-consuming process. In any case, if you’re not sure whether or not you can absorb the material in this book, glance through the code samples to get a feel for the level of complexity.
WHAT ARE THE STRENGTHS OF THIS BOOK?
The top three strengths of this book can be summarized as follows:
This is a modern textbook with up-to-date information regarding the C11 standard
There are detailed explanations of the code samples because nothing is assumed, which means that beginners can work through the examples side-by-side with the explanation
No assumptions regarding the level of programming skills of the readers
One other point to keep in mind: as you might have noticed, many introductory books are written assuming a computer science background: this book arguably is readable without that theoretical foundation.
WHAT ARE THE WEAKNESSES OF THIS BOOK?
The weaknesses of this book can be summarized as follows:
A thorough coverage of just the essentials of C in a book this short is difficult. You need to learn many details in order to become a good C programmer; hence, this book serves as a sort of stepping
stone in your learning path regarding C.
The examples are necessarily simplistic, and cannot show the best style in a book for beginners because the best style is too complex to illustrate the simple concepts.
Some readers might find the introductory level of the material boring and simple. This is not a problem of the book, but the fact that C is so low-level that the foundations appear trivial. (They absolutely are not, but they look that way to a beginner.)
HOW WERE THE CODE SAMPLES CREATED?
The code samples in this book were created and tested using bash on a Macbook Pro with OS X 10.12.6 (macOS Sierra). Regarding their content: the code samples are derived primarily from the author, and in some cases there are code samples that incorporate short sections of code from discussions in online forums. The key point to remember is that the overwhelming majority of the code samples follow the Four Cs
: they must be Clear, Concise, Complete, and Correct to the extent that it’s possible to do so, given the size of this book.
WHY ARE THERE TWO CHAPTERS ABOUT POINTERS IN C?
A misunderstanding of pointers is the most common cause of crashes in C programs. Although C pointers can be explained quickly, code samples involving pointers can quickly become difficult to understand (and also error-prone). This is a difficult subject (even for advanced beginners) if you are unfamiliar with this functionality. Hence, one chapter about C pointers simply isn’t enough to become comfortable with this topic.
As you will see, Chapter 5 contains basic code samples involving pointers, which are enough for simple C programs. If you want a deeper understanding of how to use pointer, read the code samples in Chapter 6, and experiment with your own variations of the code. If you want to become adept in a programming language, you need to actively practice writing code, which is especially true for C programs that involve pointers.
WHICH TOPICS ARE EXCLUDED?
This book does not cover hashing, searching and sorting, file I/O, data structures, threads, sockets, IPC, pipes, shared memory, message queues, and other system-level functionality that are relevant for advanced and expert-level developers. These topics are excluded because they are not suitable for an introductory C book, and there are plenty of other concepts that you need to learn in order to write C programs. Note that Chapter 7 briefly covers bit manipulation and more sophisticated C operators that you will need to learn if you become a full-time C developer.
HOW DO I SET UP A COMMAND SHELL?
If you are a Mac user, there are three ways to do so. The first method is to use Finder to navigate to Applications > Utilities and then double click on the Utilities application. Next, if you already have a command shell available, you can launch a new command shell by typing the following command:
open /Applications/Utilities/Terminal.app
A second method for Mac users is to open a new command shell on a Macbook from a command shell that is already visible simply by clicking command+n in that command shell, and your Mac will launch another command shell.
If you are a PC user, you can install Cygwin (open source https://cygwin.com/) that simulates bash commands, or use another toolkit such as MKS (a commercial product). Please read the online documentation that describes the download and installation process. Note that custom aliases are not automatically set if they are defined in a file other than the main start-up file (such as .bash_login).
WHAT ARE THE NEXT STEPS
AFTER FINISHING THIS BOOK?
The answer to this question varies widely, mainly because the answer depends heavily on your objectives. The best answer is to try a new tool or technique from the book on a problem or task you care about, professionally or personally. Precisely what that might be depends on who you are, as the needs of a data scientist, manager, student or developer are all different. In addition, keep what you learned in mind as you tackle new data cleaning or manipulation challenges. Sometimes knowing a technique is possible makes finding a solution easier, even if you have to re-read the section to remember exactly how the syntax works.
If you have reached the limits of what you have learned here and want to get further technical depth about regarding C, there are various online resources and literature describing more complex features of C.
Oswald Campesato
January 2019
ABOUT THE TECHNICAL EDITOR
Ansel Sermersheim has been working as a computer developer for nearly twenty years programming in C, C++, Lisp, Java, and Perl, with extensive knowledge in TCP/IP and multithreaded design. He has been a speaker at CppCon 2015, CppNow 2016, CppNow 2017, CppCon 2017, CppCon 2018, and numerous San Francisco Bay Area meetings of ACCU, the Association of C, and C++