-->

Learn to code the on-demand coding Languages in an easy way. We help you understand programming concepts and coding Techniques Better.

Tuesday, January 19, 2021

How To Set Up C Compiler In Pc

How to set up C compiler in PC :

                                    

How to Execute our Code?

    
We can execute our code in different ways. We will discuss some possible ways to run our code. U can choose any one of the Methods Based on your requirements. I Refers to the online compiler. 

1.Online Compiler
2.Cmd (command prompt)
3.Code blocks IDE (Integrated Development Environment )

Online Compiler: Make sure You have an Internet Connection.

    step 1: Search onlinegdb in the browser and click on the link as shown in the image.





    step 2: Make sure to choose the compiler before you code.


    step 3: Now click on Run Button and you can see the output below the code.



     step 4: The input is given in the text Box. Forgot about the  Interactive console[we will discuss this later]. 





    step 5: Here we can see the output in the stdout box.



CMD: Through cmd(command prompt) we can compile and run our code more effectively

    step 1:Type cmd in the Search bar and open cmd.
                Now type gcc -version in cmd.
                


        It seems the compiler is not set up on your pc.

        Setup Process:


            1.Click here to download the GCC Compiler.
             
            After Download Double Click on the .exe file and set up the process.

              [ click on the Image for a Better view]
                    


                                    
    
                                        
    
                                    


                                        

                                    
                                    

           
              2.Change The Environment Variables.
            
           Path:  C:\TDM-GCC-64\bin   [Copy the path of  GCC Compiler installed]
                                
            we have already set this path during the setup process step 1.



                                    
    
            
                                









            3. Now go to cmd and type gcc --version.
                                    
                                       


               Perfect, Now the compiler has been setup. 

            4. How to Compile and Run our source code in cmd.

                 1. How to save the file?
                      
                    > Open Notepad and write the program.
                    > Now press ctrl+shift+s to save the file.
                    > Save the file with .c Extension.
                    ex : file name : sample.c 
                           type         : all files

                 2.  Now open cmd and set the path of the source code file. To set the path of the file we have to change the Directory.

To change directory

cd  directory name

To Remove Directory

cd ..

To compile

gcc source file.c

To run 

executable file name

                                               
Note: Whenever we compile a source file, an Executable File will be generated. Then we have to run the Executable File. For Each source file, there exists only one Executable file. It happens only in cmd.
                                    




  3. IDE: Code Blocks


  Click here to download the code blocks ide and set up the installation process.


So far we have learned how to set up the c compiler in our system to Run programs. Select one method and practice as many problems as you can. The more problems you solve, the stronger you get in Problem-Solving and Logic Building. Keep practicing Daily:)

                                                                       Next Topic ---->What is C Language

1 comment: