Programming Environment

The Terminal

What is a terminal?

A terminal is an interface that lets us access the system with just a keyboard. This is how we will compile and execute most of our programs.

Window Command PromptBash Terminal

Writing C Code

In every programing language, code is just plain text!
We can use any text editor we want!


Integrated Development Environments (IDEs) are text editors designed for programming!
For example, Visual Studio Code

Compiling Code

To run C code, we first need to compile it.

A compiler is another program that turns our code into something the computer can run.

For C code, we can use a program called gcc

GCC

gcc <SOURCE> -o <OUTPUT>


For example, if we want to compile our source code called program.c

gcc program.c -o myprogram

Running Code

We can then run our program

./myprogram

Takeaway

  • Pick a text editor for editing code
  • Install the gcc compiler
    • Already included in Linux and Mac
  • Practise compiling and executing programs

Hello World

Home