×

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

Free() Function in C

Free() function is a built-in function which is define in the stdlib.h header file. If we want to use this function in our program, we must include the stdlib.h header...

4 minutes read.

Storage class in C

Storage class in C defines the scope, the visibility, and the lifetime of variables and functions. In other words, storage classes are used to describe the features of variables and...

3 minutes read.

Functions in C

What is function? Functions are defined as the set of announcements which take inputs, perform operations and provide results. The operation of a function only performs when the function gets called....

4 minutes read.

Random function in C

Random function in C In the C programming language, the rand() is a function used for Pseudo Random Number Generator (PRNG). The random number generated by the rand() function is not...

4 minutes read.

Multiplication Table in C

Displaying table up to 10 #include <stdio.h> int main() {     int num, i = 1;     printf("     Enter any Number:");     scanf("%d", &num);     printf("Multiplication table of %d: ", num);  ...

1 minute read.

Sizeof in C

A pointer in C is defined as a variable that stores the information of the address of another variable. A pointer can be incremented or decremented, which means we can...

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.

fopen() function in C

fopen() function, is one of the file handling functions. It is used to open the existing file and perform operations on the file. If the file does not exist, it...

3 minutes read.

Multithreading in C interview questions

Q1. What exactly is a thread? Ans: A thread is a brief sequence of instructions intended to be planned and carried out by the CPU apart from the parent process. Q2. Can...

4 minutes read.

Volatile in C

Introduction A volatile keyword is a qualifier in C. Qualifiers are nothing but keywords which are used to modify the properties of a variable. Qualifiers are of two types: 1) Const The const type...

3 minutes read.

Malloc function in C

When the user or programmer does not know how much memory space is needed in the application, it a needs dynamic memory allocation during runtime. Dynamic memory allocation helps us to...

4 minutes read.

How to install a C compiler in windows 10-64bit

Many C compilers can be installed on your pc. The most downloaded compilers include GCC, Turbo C++, Visual Studio, etc. This article includes the installation of the Turbo C++ compiler in...

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

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.

Find out Power without using POW function in C

Introduction: In this discussion, we will discuss how we find out power without using the POW function in C. In this article, you'll understand how to compute integer powers in...

3 minutes read.

Static in C

Static is a keyword that is used in the C programming language. It can be used both as variables and as functions. In other words, it can be declared both...

3 minutes read.

Ftell() Function in C

Ftell(): In File Handling we have some special functions like Ftell(), Fseek(), rewind() etc.. while you are randomly accessing the file these functions play very important role and these functions...

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.

Bit Stuffing Program in C

What is a Bit Stuffing? The process of inserting one or more extra bits (0) into data is known as bit stuffing. To provide signalling information to a recipient, these are...

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