0% found this document useful (0 votes)
17 views2 pages

Untitled Document

The document discusses how to install a C compiler in VirtualBox and run a factorial program. It describes downloading and installing the GCC compiler package and verifying the installation. It then explains the basic process to write, compile, and run a simple C program.

Uploaded by

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

Untitled Document

The document discusses how to install a C compiler in VirtualBox and run a factorial program. It describes downloading and installing the GCC compiler package and verifying the installation. It then explains the basic process to write, compile, and run a simple C program.

Uploaded by

mango0000007007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

How to Install a C Compiler in VirtualBox and Run a Factorial

Program.

1. Open a terminal window in Kali Linux. You can do this by clicking on the terminal
icon in the taskbar or by searching for "Terminal" in the applications menu.
2. Update the package lists to ensure you have the latest information about
available packages by running the following command:-

sudo apt update


3. Once the update is complete, you can install the GCC compiler by running:-

sudo apt install build-essential

4. During the installation process, you may be prompted to confirm the installation
by typing 'Y' and pressing Enter.
5. After the installation is complete, you can verify that GCC (the C compiler) has
been installed successfully by typing:-

gcc --version

6. This command should display the version of GCC installed on your system. Now,
you have successfully installed the C compiler (gcc) in Kali Linux, and you can
start compiling and running C programs.

To run a C program, you'll typically follow these steps:

1. Write Your C Program: First, you need to write your C program using a text editor.
Save the file with a .c extension.
2. Open a Terminal: Open a terminal or command prompt window. This is where
you'll compile and run your C program.
3. Navigate to the Directory: Use the cd command to navigate to the directory where
your C program is saved. For example, if your program is saved in the Documents
directory, you would use:
cd Documents

4. Compile the Program: Use a C compiler (like gcc) to compile your C program. The
basic syntax is:-

gcc -o output_file_name input_file_name.c

5. For example, if your C program is named my_program.c, you would use:-

gcc -o my_program my_program.c

(This will generate an executable file named my_program (or whatever you
specify after the -o option))

6. Run the Program: After compiling successfully, you can run the executable file
generated in the previous step. To run the program, simply type its name and
press Enter. For example:

./my_program

7. View Output: If your program produces any output, it will be displayed in the
terminal after running the program.

You might also like