C Language
* Before learning the C language compiler installation process, you must clear a basic concept about assembler, compiler & interpreter.
An assembler, compiler, and interpreter are all tools used in the field of computer programming and software development to facilitate the process of converting high-level programming code into machine code or executing it. Each of these tools serves a different purpose and operates in a distinct way.
Installation of C Compiler
To install a C compiler on your computer, you will need to choose a specific C compiler based on your operating system. The two most commonly used C compilers are GCC (GNU Compiler Collection) and Code::Blocks. Here are instructions for installing these compilers on different operating systems:
1. Installing GCC:
On Linux:
Most Linux distributions come with GCC pre-installed. To check if it's installed, open a terminal and run the following command:
gcc --version
If GCC is not installed, you can install it using your package manager. For example, on Ubuntu or Debian-based systems, you can use:
sudo apt-get update sudo apt-get install gcc
On macOS:
macOS doesn't come with GCC pre-installed, but you can install it using the Homebrew package manager. First, install Homebrew if you haven't already by following the instructions at https://brew.sh/. Then, run the following command to install GCC:
brew install gcc
On Windows:
You can install GCC on Windows using the Windows Subsystem for Linux (WSL). First, install WSL following the Microsoft documentation (https://docs.microsoft.com/en-us/windows/wsl/install). After setting up WSL, you can use the Linux package manager to install GCC, just like you would on a Linux system.
Still, You can also try this one-line command (In administrator mode) for a quick installation process:
wsl --install -d ubuntu
2. Code::Blocks:
Code::Blocks is an open-source & cross-platform integrated development environment (IDE) used for programming in various programming languages. It provides a user-friendly interface for writing, compiling, and debugging code. Code::Blocks is particularly popular among C and C++ developers, but it supports multiple programming languages and can be extended with plugins to support additional languages and functionality.
Compile the C File
To compile 'hello.c' using GCC, run the following command:
gcc hello.c -o hello
That's it! You've successfully compiled and run a C program from the command line. Remember to replace 'hello.c' and hello with your C source file's name and the desired output executable name.
Representations of Program
Source program, object program, and executable program are three stages or representations of a computer program during the software development process. Each serves a specific purpose and has distinct characteristics. Here's an explanation of the differences between them:
Source Program:
The set of instruction written in any one of the programming languages is called source program.
Object Program:
The translated or binary form of a source program is called an object program.
Executable Program:
A program generated from object program by linking the input/output devices in order to execute th instructions given in a source program is called an executable program.
What's Next?
We've now entered the finance section on this platform, where you can enhance your financial literacy.