0% found this document useful (0 votes)
75 views1 page

Ubuntu C Execution Guide

This document provides a step-by-step guide for running a C program in Ubuntu. It covers opening the terminal, creating or editing a C file, writing code, saving and exiting the editor, compiling the program, running the executable, and viewing the output. Each step includes specific commands and instructions to ensure successful execution of the C program.

Uploaded by

pgirish4a91
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views1 page

Ubuntu C Execution Guide

This document provides a step-by-step guide for running a C program in Ubuntu. It covers opening the terminal, creating or editing a C file, writing code, saving and exiting the editor, compiling the program, running the executable, and viewing the output. Each step includes specific commands and instructions to ensure successful execution of the C program.

Uploaded by

pgirish4a91
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Step-by-Step Guide to Running a C Program in Ubuntu

1. Open Terminal

Press Ctrl + Alt + T to open the terminal.

2. Create or Edit the C Program File

Use the vi editor to open a new or existing file:

bash

CopyEdit

vi programname.c

3. Enter Insert Mode & Write Code

 Press i to enter insert mode.

 Type or paste your C program.

4. Save & Exit the Editor

 Press Esc to exit insert mode.

 Type :wq and press Enter to save and exit.

5. Compile the C Program

Run the following command:

bash

CopyEdit

gcc programname.c

 If there are errors, open the file again using:

bash

CopyEdit

vi programname.c

 Use the up arrow (↑) to retrieve the previous command.

 Press i to edit, fix the errors, then repeat Step 4.

 Recompile using:

bash

CopyEdit

gcc programname.c

6. Run the Executable

If there are no errors, run your program with:

bash

CopyEdit

./[Link]

7. View Output

Your program’s output will be displayed on the terminal.

You might also like