Untitled Document
Untitled Document
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:-
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.
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:-
(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.