Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to compile and run C program in Ubuntu?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 292
    Comment on it

    Hello friends,

    Today we will learn how to compile and run a C program in Ubuntu using the following steps:

    Step 1. Open your terminal.
    Step 2. Now type the following command:

    gedit cprg.c

    The above command open a text editor in which you will write your c source code as follows:

    #include <stdio.h>
    main() {
    printf("Run C program in ubuntu\n");
    }

    Save it and Close your text editor.
    Step 3. Now type the following command on the terminal:

    gcc -o cprg cprg.c

    The above command compile your file and create a executable file cprg with the output(-o) of the program. 
    Step 4. In last step, you will execute your program with the help of following command:

    ./cprg

    Output will be as follows:

    Run C program in ubuntu

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: