×

C Language Environment Setup

To compile C program, we must have GCC compiler installed on our machine. In this C tutorial, all the examples are compiled and tested using GCC compiler. Although we can use other C compilers also, GCC provides better performance. Installation To installGCC(GNU Compiler Collection), visit official site (http://mingw.org/download/installer)and download after downloading we can install it in our system and compile or executeCand C++ program easily. There are following some step to install GCC compiler in windows.
  • Download GCC (GNU Compiler Collection)compiler software.
  • Install it inside the system.
  • Opengcc command prompt and locate to the C source file location by using command. E.g. cd d:\c-program\Document> file-name.
  • To compileC program we can use gcc hello.c
  • We can execute compiled program by using EXE file (a.exe), at the time of compilation it will automatically create an a.exe file. We can execute that executable file in a different system at the same platform.
What is Compiler in C?
Compiler is a computer program that converts the human readable (programming language) source code into another computer language (binary code). In other words, we can say that  compiler takes the code and convert in to the binary code that computer can understand easily.

List of C compilers for windows OS
There is various compiler of C & C++ language for windows that are given below:
  • CCS C Compiler
  • Turbo C
  • Minimalist GNU for Windows (MinGW)
  • Portable C Compiler
  • Clang C++
  • Digital Mars C++ Compiler
  • Intel C++
  • IBM C++
  • Visual C++ : Express Edition
  • Oracle C++
All of these above compilers for C are open source (free), but there are some other paid C compilers. We can get it for trial version:
  • Embarcadero C++
  • Edison Design Group C++
  • Green Hills C++
  • HP C++ for Unix
  • Intel C++ for Windows, Linux, and some embedded systems.
  • Microsoft C++
  • Paradigm C++
Note: In this tutorial, we used GCC Compiler andsome text editor like Notepad or Notepad++. We can also use other IDE or editor. First C Program Before starting C program, we have to follow some basic rules of the C program that are listed below:
Basic Command Description
#include <stdio.h> We have to include standard input-output library functions.
void main() It is a keyword that returns no value.
printf() This function is used to print the data on the console.
system(“cls”) This function is used to clear the output screen.
/* some comments */ We can comment any line with this symbol that comment will not visible at the time of output.
return 0; This command terminated the program ( main function) and returns 0.

Example
#include<stdio.h>
int main(){ 
/* comment section*/
printf("Hello friends"); 
return 0;
}
 

How to compile and execute the C program by using GCC compiler?
We can compile and execute the C program by using GCC compiler.
  • For Compilation
We can compile the C program by using command gcc <filen-name>. C
  • For Execution
We can execute the compiled program by writing the exe fileof the program.

Note: At the time of compilation of the C program, the “a.exe”exe file name will be created automatically but if we want to create own exe file, then the given above example will help us to understand easily.
syntax:Gcc –o .c

Related Topics

Distance Vector Routing Protocol Program in c

A distance-vector routing protocol is one of the foremost instructions of routing protocols in pc conversation principle for packet-switched networks. The hyperlink-nation protocol is the alternative foremost class.The Bellman-Ford set...

4 minutes read.

Compound Interest Program in C

Interest on loans and deposits is compound interest. This is the most commonly used concept in everyday life. Compound interest on an amount is based on principal and interest earned...

3 minutes read.

Types of Pointers in C

Pointers in C A pointer is a variable and this variable contains the address of another variable, i.e it’s a variable which has the address of another variable as its value....

4 minutes read.

Queue implementation in C

In the C programming language, the queue is the abstract concept that is similar to stacks. However, it is the part of the data structures that work opposite to that...

4 minutes read.

How to Find Square Free Numbers in C?

Introduction Square-free number program is a typical interview and academic question in C Programming. In this section, we will define square-free integers, construct algorithms and C program to print the nth...

11 minutes read.

Caesar Cipher Program in C

What is Caesar Cipher? The Caesar Cipher is a type of substitution cipher that is named after Julius Caesar, who is said to have used it to encrypt messages sent to...

2 minutes read.

Write a program that produces different results in C and C++

In this tutorial, we'll explore several programs that, depending on whether they are developed using C or C++ compilers, will produce varying outputs. There are numerous similar programs, but we will just...

2 minutes read.

SJF Scheduling Program in C

The SJF (shortest job first) or the shortest job next is the programming scheduling in the C. It is one of the CPU scheduling programming. The SJF is defined as...

4 minutes read.

C Program to find the size of a File

Before knowing about the Program, you need to understand what the size of a file is. After that, you should know how it is going to work with the given...

4 minutes read.

Flow Chart of Do while loop in C

This is a flowchart that represents the process of executing the Do while loop in the C programming language Generally, as we know there are three main components of Do While...

3 minutes read.

Variable Declaration in C

What is a Variable? A Variable is nothing more than a name for a memory place where data/information can be stored. Any alphabet (from a to z or A to Z), the...

4 minutes read.

Dynamic memory allocation

Dynamic memory allocation is used to allocate the memory at runtime. It has following function within <stdlib.h> header file. Function Syntax malloc() malloc (number *sizeof(int)); calloc() calloc (number, sizeof(int)); realloc() realloc (pointer_name, number * sizeof(int)); free() free (pointer_name); malloc() function The process...

2 minutes read.

Explain the Increment and Decrement Operators in C

In the C programming language, the increment operator (++) and the decrement operator (--) are used to increase or decreasing a variable’s value by 1, respectively. The increment operator is written...

10 minutes read.

Stack implementation in C

Stack implementation in C Stack stores the data in a particular order. It is a linear data structure that follows the principle of the Last In First Out (LIFO) technique where...

3 minutes read.

Goto and Labels in C

Introduction Goto in C: The goto statement is known as the jump statement in C. The goto is used to transfer the control of a program to a predefined label. The goto...

3 minutes read.

Pascal Triangle in C

The pascal triangle in c is an array of binomial coefficients in triangular form. Here the nth row contains the binomial coefficient of ncr.In a pascal triangle, every number is...

2 minutes read.

Add two numbers using the function in C

Here we will learn how to add two numbers by creating function in C. Let’s learn this with help of example. Code: - #include <stdio.h> int add_two_no(int a, int b); int main(){   int first_num,...

1 minute read.

Strcpy() in C

In C language many operations can be performed on a string. Characters in a sequence are known as string. Note:   To use this function we must include the #include<string.h> header file...

4 minutes read.

How to find square root in C Language

Before understanding the square root program in C language, one must know about the square root of a number. A square root is a mathematical term. The square root of a...

5 minutes read.

Difference between rand() and srand() function in C

What is the rand()?The rand() means random function. This function is used in C. It generates random numbers in the range of 0 to the RAND_MAX. Suppose we generate a...

3 minutes read.