In the context of C programming, the term “commands” often refers to the instructions written in a C program. However, when it comes to interacting with the terminal or command-line interface (CLI), what are often referred to as “commands” are the executables or scripts that can be run from the terminal. The term “command” can also refer to the instruction given in the terminal to compile or run a program.
Here are some interactions related to C programming that one might perform in a terminal:
- Compiling a C program:
- To compile a C program, you would typically use a command like this, where
gcc
is the compiler, andprogram.c
is the source file:bash gcc -o program program.c
- The
-o program
part tells the compiler to create an output file namedprogram
.
- To compile a C program, you would typically use a command like this, where
- Running a C program:
- After compiling, you would run the program with a command like this:
bash ./program
- After compiling, you would run the program with a command like this:
- Debugging a C program:
- You might use a debugger like
gdb
to debug your program:bash gdb ./program
- You might use a debugger like
- Cleaning up compiled files:
- If you have a
Makefile
, you might have a command to clean up compiled files:bash make clean
- If you have a
These are not “C commands” per se, but rather terminal commands related to the compilation, execution, and debugging of C programs. In each of these examples, gcc
, ./program
, gdb
, and make
are commands executed in the terminal, not commands within the C programming language itself.