Learn C Programming
A beginner's guide to learning C programming the easy and disciplined way
Jeff Szuhay
- 646 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
Learn C Programming
A beginner's guide to learning C programming the easy and disciplined way
Jeff Szuhay
About This Book
Get started with writing simple programs in C while learning the skills that will help you work with practically any programming language
Key Features
- Learn essential C concepts such as variables, data structures, functions, loops, arrays, and pointers
- Get to grips with the core programming aspects that form the base of many modern programming languages
- Explore the expressiveness and versatility of the C language with the help of sample programs
Book Description
C is a powerful general-purpose programming language that is excellent for beginners to learn. This book will introduce you to computer programming and software development using C. If you're an experienced developer, this book will help you to become familiar with the C programming language.
This C programming book takes you through basic programming concepts and shows you how to implement them in C. Throughout the book, you'll create and run programs that make use of one or more C concepts, such as program structure with functions, data types, and conditional statements. You'll also see how to use looping and iteration, arrays, pointers, and strings. As you make progress, you'll cover code documentation, testing and validation methods, basic input/output, and how to write complete programs in C.
By the end of the book, you'll have developed basic programming skills in C, that you can apply to other programming languages and will develop a solid foundation for you to advance as a programmer.
What you will learn
- Understand fundamental programming concepts and implement them in C
- Write working programs with an emphasis on code indentation and readability
- Break existing programs intentionally and learn how to debug code
- Adopt good coding practices and develop a clean coding style
- Explore general programming concepts that are applicable to more advanced projects
- Discover how you can use building blocks to make more complex and interesting programs
- Use C Standard Library functions and understand why doing this is desirable
Who this book is for
This book is written for two very diverse audiences.
If you're an absolute beginner who only has basic familiarity with operating a computer, this book will help you learn the most fundamental concepts and practices you need to know to become a successful C programmer.
If you're an experienced programmer, you'll find the full range of C syntax as well as common C idioms. You can skim through the explanations and focus primarily on the source code provided.
Frequently asked questions
Information
- Chapter 1, Running Hello, World!
- Chapter 2, Understanding Program Structures
- Chapter 3, Working with Basic Data Types
- Chapter 4, Using Variables and Assignment
- Chapter 5, Exploring Operators and Expressions
- Chapter 6, Exploring Conditional Program Flow
- Chapter 7, Exploring Loops and Iteration
- Chapter 8, Creating and Using Enumerations
- Writing your first C program
- Understanding the program development cycle
- Creating, typing into a text editor, and saving your C program
- Compiling your first C program
- Running your program, verifying its result, and, if necessary, fixing it
- Exploring different commenting styles and using them
- Employing guided chaos, followed by careful observation for deeper learning
Technical requirements
- A basic text editor that is able to save unformatted plain text
- A Terminal window that commands can be entered into via the command line
- A compiler to build your C programs with
Writing your first C program
Hello, world!
#include <stdio.h>
int main()
{
printf( "Hello, world!\n" );
return 0;
}
Understanding the program development cycle
- Interpreted: In an interpreted environment such as Python or Ruby, the program can be entered line by line and run at any point. Each line is evaluated and executed as it's entered and the results are immediately returned to the console. Interpreted environments are dynamic because they provide immediate feedback and are useful for the rapid exploration of algorithms and program features. Programs entered here tend to require the interpreting environment to be running as well.
- Compiled: In a compiled environment such as C, C++, C#, or Objective-C, programs are entered into one or more files, then compiled all at once, and if no errors are found, the program can be run as a whole. Each of these phases is distinct, with separate programs used for each phase. Compiled programs tend to execute faster since there is a separate, full compilation phase, and can be run independently of the interpreting environment.
Edit
- File manipulation: Open a file, edit a file, save the file and any changes that have been made to it, and save the file with another name.
- The ability to navigate the file: Move up, down, left, right, to the beginning of the line, end of the line, beginning of the file, end of the file, and so on.
- Text manipulation: Insert text, delete text, insert line, delete line, selection, cut, copy, paste, undo/redo, and so on.
- Search and replace: Find text, replace text, and so on.
- Automatic indentation
- Syntax coloring for the specific programming language
- Automatic periodic saving
- Everywhere:Nano, which runs in a Terminal; a moderate learning curve.
- Linux/Unix:
- Vim, or vi: Runs in a Terminal; a moderate learning curve. It is on every Linux/Unix system, so it's worth learning how to use its basic features.
- gedit: A powerful general-purpose editor.
- Emacs: An everything and the kitchen sink editor; a very large learning curve.
- Windows:
- Notepad: Very simple – sometimes too simple for programming – but included in every Windows system.
- Notepad++: A better version of Notepad with many features for programming.
- macOS only: BBEdit (free version), which is a full-featured GUI programming text editor.