What happens when you run gcc main.c?
What is gcc?
First to start thing we need to know what gcc is. The GNU Compiler Collection (GCC) is a compiler system produced by the GNU Project supporting various programming languages. GCC is a key component of the GNU toolchain and the standard compiler for most projects related to GNU and Linux, including the Linux kernel.
The Free Software Foundation (FSF) distributes GCC under the GNU General Public License (GNU GPL). GCC has played an important role in the growth of free software, as both a tool and an example.
For more information about gcc visit: https://en.m.wikipedia.org/wiki/GNU_Compiler_Collection
What is the C programming language?
C is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, while a static type system prevents unintended operations.
By design, C provides constructs that map efficiently to typical machine instructions and has found lasting use in applications previously coded in assembly language. Such applications include operating systems and various application software for computers, from supercomputers to embedded systems.
For more information about C visit: https://en.wikipedia.org/wiki/C_(programming_language)
Steps on how to use gcc
- First step is to open your Terminal/Command prompt.
- create a file using the C programming language, the file must have the format .c at the end of its name.
- now this c file will have a program that will print: Hello, World! but for that to happen we need to compile said file in order to present the output. We use the command gcc in order to compile the main.c file.
- What gcc will do is to make the main.c file executable so it will print the text Hello, World!
- Now that we have compiled our file we can now execute it using this command: ./a-out .
Now that we have executed our main.c file we have printed the words Hello, World! The gcc command will compile files on C programming language and will make those executable to run in your Terminal/ Command prompt.