Exercise 1. Dust Off That Compiler

After you have everything installed, you need to confirm that your compiler works. The easiest way to do that is to write a C program. Since you should already know at least one programming language, I believe you can start with a small but extensive example.

ex1.c

 1   #include <stdio.h>  2  3   /* This is a comment. */  4   int main(int argc, char *argv[])  5   {  6       int distance = 100;  7  8       // this is also a comment  9       printf("You are %d miles away.\n", distance); 10 11       return 0; 12   }

If you have problems getting the code up and running, watch the video for this exercise to see me do it first.

Breaking It Down

There are a few features of the C language ...

Get Learn C the Hard Way: A Clear & Direct Introduction To Modern C Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.