Running C Program from the terminal might be difficult for many new developers and programmers but believe me, it’s very easy than it looks.
Basically, you just need to follow 3 steps to run your C Program from Terminal!
PreRequisites
You need to have gcc installed on your system and make sure to set up the path on your windows machine:P
You can check if gcc is installed or not via:
gcc -v
The result of the code might differ according to the OS and the version of gcc
If your system has gcc then you can proceed to next step😉
1. Save a file with a .c extension in it
Here, I have saved my code in “program.c” filename on my desired path.
2. Compile your code
gcc filename.c -o filename
This will compile your code and create an executable named filename!
Here you can see a new file program is being created which is an executable file.
3. Run the program
./filename
You can run the program by executing the executable file
Horray! You have successfully executed your program from the terminal🥳
Hope it has helped you!
Really Helpful!
Do apply in your everyday use 😉
Great, recommend everyone to try using command. It wil surely give another level experience.
Yes satya, it will forsure enhance one’s experience!
Very Helpful. We are expecting more blogs on file system of Unix like OS.
Gotcha pravin, UNIX blogs are on the way:D
thanks daju ❤️