×

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

Find occurrence of substring in C using function

Introduction: In this article, we discuss finding the occurrence of a substring in C using function. This software takes strings and substrings as input and counts the occurrences of substrings within...

3 minutes read.

Fee Management System in C

The concept is to split every operation into its very own characteristic. Software is made from all of the capabilities mixed with transfer cases. An example of the capabilities may...

5 minutes read.

Binary Search in C with Best and Worst Time Complexity

What is Binary Search? Binary search is an algorithm that is used to find an element in a sorted array efficiently. It has a time complexity of O(log n). It means...

3 minutes read.

Conditional Operator in C

In C programming language, the conditional operator (also known as the ternary operator) is a shorthand way of writing an if-else statement. The syntax of conditional operator in C is...

3 minutes read.

Branching Statements in C

What is branching in c? Branching gets its name from the fact that the computer can select which branch to follow.Programs written in the C language execute statements one after the...

6 minutes read.

Quick sort in C

Quick-sort, in the same way, like a merge sort, follows the principle of the divide and conquer algorithm. It then picks an element as pivot and partitions, and the given...

4 minutes read.

Ferror() in c

Ferror():  In C, the ferror() function checks assuming there is a blunder in the given stream. The ferror() function is utilized to check for the document blunder on given stream. A return...

4 minutes read.

What are linker and loader in C

Linker and loader are utility programs that have a significant role in executing a program. Linker: A linker is a program that joins the object files produced by the assembler/ compiler...

3 minutes read.

Unformatted input() and output() function in C

Unformatted Input and Output functions take the character, character array, and strings as input. We can read-only character data types with these functions. These functions are already defined in the...

5 minutes read.

Round Robin Scheduling in C

Round Robin Scheduling in C Round robin is a CPU (Central Processing Unit) scheduling algorithm designed to share the time systems. It is one of the simplest and easiest scheduling algorithms...

4 minutes read.

Remove an element from an array in C

A collection of objects or pieces of the same data type stored in a single memory block is known as an array. A data structure called an array is used...

3 minutes read.

clrscr in C

clrscr function in C clrscr stands for: clr = clear scr= screen When the clrscr() function is called in a program everything currently displayed in the console(output of previous programs, output of current program,...

3 minutes read.

How to open a C file on android mobile

A C file is a file that has a .c extension and contains code written in the C language. C is a computer programming language developed by Dennis Ritchie at...

4 minutes read.

Expressions in C

Expressions in C: In the C programming language, an expression defines a formula in which the operands are linked to each other by using operators to compute the value. The operand...

4 minutes read.

GPA Calculator in C

GPA stands for Grade Point Average. This GPA is used to measure the student's academic performance in educational institutes. By using this, segregation takes place and lets us know how...

4 minutes read.

Limitations of Synchronisation and Uses of Static Synchronisation in Multithreading

The multithreading component of java is the element around which the idea rotates as it permits simultaneous execution of at least two program pieces for the most significant usage of...

9 minutes read.

Attributes in C

Attributes are one of modern C++ key features. It is the process by which initiator can add more information to the language instead of introducing new keywords for every attribute....

4 minutes read.

User Defined Functions in C

C Functions: A function is defined as a block of code that is used to perform some specific task. In functions, we use flower brackets ({}) which contain the set of programming...

5 minutes read.

Explain the two-way selection in C

In C programming, a two-way selection statement is used to choose between two different options based on a Boolean expression. The two-way selection statement in C is the if statement. The...

6 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.