How to Run C program in Windows, Mac, Linux?
If you have already installed C you can skip to part 1 where an overview is provided 101/Introduction to C - part 1 or you can start from some core topics here 101/Introduction to C - part 2
If you want to install PyCharm you may follow the installation guide here>> How to Install PyCharm?
If you want to install PyCharm you may follow the installation guide here>> How to Install PyCharm?
Ways to run C:
1. Using Online Compilers is the easiest way to run your C program, here is the Online Compiler that I prefer: https://rextester.com/l/c_online_compiler_gcc
2. Installing C compilers in system.
Windows:
I prefer Dev C/C++ compiler, so here the steps to follow:
1. Download the source file here : Dev C/C++ setup
1. Download the source file here : Dev C/C++ setup
2. After downloading run the setup you will see the 'select language' pop-up:
4. Next you will be asked to choose installation type, by defualt it is full. Click next.
5. You can install Dev-C++ to your desired location. You can now click the Install button
6. Lay back and relax till the installation completes.
7. You're ready to Finish.
8. Select your Language and click next.
9. Choose your theme and move ahead by clicking next.
10. Here you are. Go for the OK button.
11. Now you are ready to code. Create your first new project with Ctrl + n or go to file > new > project and select your type of program. Click ok and start coding in C.
How to Run and Compile C program in Dev C/C++
- You can compile your program using f9 or go to execute > compile.
- Then you can run it using f10 or go to execute > run.
- Or you can do above both step at same time by using f11 or go to execute > compile and run. (I see you're really confident😛)
Mac:
Step 1) open the terminal
Step 2) run the following command for installing GCC compiler in Mac
xcode-select –install
How to run :
Step 1) compiling the program using this command:
gcc -Wall filename.c -o outputfileName
where “gcc” is compiler “filename.c” is the file you want to compile, "-o" means the output, outputfileName is the name of output file of the program which has to be run in the next step.
Step 2) Since the compilation is completed, you can use the following command to run the compiled program.
./outputfileName
Ubuntu:
Step 1) for installing the GCC compiler run the followings command in the Terminal :
sudo apt-get update
sudo apt-get upgarde
sudo apt-get install build-essential
Step 2) To confirm the installation is succesfull run the following command.
gcc -v
It must display the version of gcc installed.
How to run:
Step 1) To compile the program run the command
gcc filename.c -o outputfileName
where “gcc” is compiler “filename.c” is the file you want to compile, "-o" means the output, outputfileName is the name of output file of the program which has to be run in the next step.
Step 2) Since the compilation is completed, you can use the following command to run the compiled program.
./outputfileName
Now you have installed the C compilers in your system, It's the time to learn "How to Code in C - Introduction Part 1" and How to Code in C - Introduction Part 2,
If you have any suggestion for us do comment so that we can improve and provide easiest way to understand CS Things for beginners ;)
cya at my home page again :)
Comments
Post a Comment