C How To Program 9 e Before You Begin
C How To Program 9 e Before You Begin
C How To Program 9 e Before You Begin
Begin
Before using this book, please read this section to understand our conventions and
ensure that your computer can compile and run our example programs.
This Before You Begin section describes installing the compilers. Section 1.10’s test-
drives demonstrate how to compile and run C programs using these compilers.
If it does not recognize the command, you must install GNU gcc. We use the
Ubuntu Linux distribution. On that distribution, you must be logged in as an admin-
istrator or have the administrator password to execute the following commands:
1. sudo apt update
2. sudo apt install build-essential gdb
Linux distributions often use different software installation and upgrade tech-
niques. If you are not using Ubuntu Linux, search online for “Install GCC on MyLi-
nuxDistribution” and replace MyLinuxDistribution with your Linux version. You can
download the GNU Compiler Collection for various platforms at:
https://gcc.gnu.org/install/binaries.html
To access our code files, use the cd command change the folder within Ubuntu to:
cd /mnt/c/Users/YourUserName/Documents/examples
Use your own user name and update the path to where you placed our examples on
your system.
Installing Docker
To use the GCC Docker container, first install Docker. Windows (64-bit)3 and
macOS users should download and run the Docker Desktop installer from:
https://www.docker.com/get-started
then follow the on-screen instructions. Linux users should install Docker Engine from:
https://docs.docker.com/engine/install/
Also, sign up for a Docker Hub account on this webpage so you can install pre-config-
ured containers from https://hub.docker.com.
Docker downloads the GNU Compiler Collection (GCC) container’s current ver-
sion.4 In one of Section 1.10’s test-drives, we’ll demonstrate how to execute the con-
tainer and use it to compile and run C programs.