This includes functionality for input/output – stdio.h
means standard
library, input/output header.
What’s a header?
A header is just a text file containing details about functions, data-types and
global variables. In this case it contains details about the printf
function
used below (as well as some other stuff).
🐱
Can you remind me how do I compile the program?
🐶
First, get up a Linux or macOS terminal.
If you are on Windows, I recommend Microsoft’s Windows Subsystem for Linux, which will get you a Linux system.
Once you have that, make sure you are in the directory containing
hello.c
. You can navigate inside a terminal usingcd
, find out where you are usingpwd
, and list the contents of the current directory usingls
.In this directory, run the command
gcc hello.c -o hello
. You might have to installgcc
first, and if you are onmacOS
you could try usingclang
instead ofgcc
. Bothgcc
andclang
are C compilers, which turn thehello.c
text file into an executable binary file.Finally, you can run the binary using
./hello
, which should printHello, world
onto the terminal. If you have got to this point, well done, you are set for the rest of the book.If you have not, then you might want to look into using a terminal a bit more, compiling C programs. If you are stuck, try navigating to the GitHub issues for this book, and you can ask a question there.