c is a language where you need to compile the code you've written. You do that by starting a C
compiler and give the file containing your C code as input.
Example:
File: myfirstcprogram.c
#include <stdio.h>
int main(void) {
printf("Hello World!\n");
}
Then at the zsh prompt, invoke the compiler:
cc myfirstcprogram.c -o myfirstcprogram
-o myfirstcprogram
is here an argument to the compiler telling it what to call the final program.
cc
may be clang
or gcc
or any other compiler you've got installed if cc
isn't already linked to the proper compiler.
When the compilation is done, the executable myfirstcprogram
should have been created. You can now run it from your zsh prompt:
./myfirstcprogram
You can run it without recompiling it as many times as you like. Only when you change the source code (myfirstcprogram.c
) do you need to compile the program into an executable again.