To compile a C program, you typically use the gcc (GNU Compiler Collection) command. Here’s a step-by-step guide:
Write Your C Code: Create a C source file, for example,
program.c.Open Terminal: Navigate to the directory where your C file is located.
Compile the Program: Use the following command:
gcc program.c -o programgcc: The compiler command.program.c: Your C source file.-o program: This option specifies the name of the output executable file (in this case,program).
Run the Compiled Program: After successful compilation, run the program using:
./program
Make sure you have gcc installed on your system. If you need help with installation or have any other questions, let me know!
