Skip to main content

How to Install C ?(Windows, Mac, Ubuntu)

 

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?

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

     2Installing 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

     2. After downloading run the setup you will see the 'select language' pop-up:

    3. Then you will prompted to agree the terms & condition, click I Agree button. (No looking back 😛)
    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

    Popular posts from this blog

    How to Install PyCharm? (Windows, Mac, Ubuntu)

      A little introduction PyCharm is one of the widely used IDE for python programming and used by many programmers these days. It is available in three editions: Professional, Community and Educational (Edu). We will prefer Edu edition as it is an open source and free to use. Also, it fits our purpose of learning python as a beginner. If you have already installed pycharm or some other compiler you can skip this and read the tutotrial here>> Let's Get Started with Python Install PyCharm You can go to the official page and follow the guide to installation, to go to the official page click here or stick with me and follow the steps below. This is the direct link to install PyCharm Edu>> click here Already Installed PyCharm Community or Professional? Then you just need to install EduTools Plugin. To install the plugin follow these simple steps: 1.        Go to Files>>Settings... or Press Ctrl+Alt+S to open Setting/Preferences dialogue. 2.  

    101/Introduction to C language - part 1

    We are assuming you have C compiler already Installed in your systems, if not you can read  How to install C compilers ? (Ubuntu, Mac, Windows) What is C ? C is high-level compared to assembly but low leveled compared to JavaScript. But in general terms C is considered as high level language . So when we talk about c language, we usually hear the following terms Header file Data types Variables Main function Operators Hello World Program ( gateway to programming world  😉 ) Addition/Subtraction program for the basic understanding of Operators What is Header File ? As a beginner I never got a satisfactory answer for the same. In a nutshell, we can say “ It's just like a brain to a body ” ,  It enables us to use the functionality which is pre-implemented by the Developers, just like the brain adds the functionality to other body parts. Header file has a file extension of '.h'  for example “stdio.h” also called standard input-ou

    Let’s Get Started with Python

    NOTE: The tutorial is aimed at people who have no prior programming experience. If you have previous experience with other programming language (C) and just want to compare the syntax you can jump to this page (link will be updated soon). If you have no compilers installed then you may follow the installation guide here>> How to Install PyCharm? Tutorial00 Statements Let’s start by using  print() , it simply prints whatever you type in double or single codes. As per the tradition let’s print Hello World. In the python file you created type print(“Hello World”) or print(‘Hello World’) as shown below