C-Program
- IntroductionSetting Up the EnvironmentBasic Syntax of CPrintf and Scanf in cComments in CVariables and Data TypesOperators in CControl StatementsDecision Making statementLoops in CNested Loops and Pattern ProgramsJump StatementFunctions in CArrays in cStrings in cPointers in cFunctions and PointersStructures and UnionsDynamic Memory AllocationFile Handling in CImportant Programs and Problem SolvingMini Projects in CC Interview Questions and AnswersC Practice Question Bank
Setting Up the Environment
Last Updated on: 22nd Oct 2025 20:20:16 PM
Before writing C programs, you need to set up your computer with a C compiler. A compiler converts your code into machine language so your computer can run it.
Installing a C Compiler :
There are several C compilers available. Two of the most commonly used are:
Option 1: Dev-C++ (Recommended for Beginners)
Dev-C++ 5.11 is a lightweight and user-friendly IDE (Integrated Development Environment) that includes a compiler.
=> Steps to Install:
-
Download Dev-C++ 5.11 from a trusted source (like SourceForge).
-
Run the
.exesetup file. -
Follow the installation steps (click "Next" until it's complete).
-
Open Dev-C++ after installation.
Note: Dev-C++ uses the MinGW (GCC) compiler internally, which is widely used and supports modern C standards.
Option 2: Turbo C++ (Old But Popular in Schools)
Turbo C++ is a DOS-based compiler still used in some educational institutions.
=> Steps to Install:
-
Download Turbo C++ (ideally a Windows-compatible version or use DOSBox).
-
Install and run the setup.
-
Use
Alt + F9to compile andCtrl + F9to run a program.
Note: Turbo C++ is outdated and does not support many modern features. It is not recommended for professional use.
Writing and Running Your First C Program
Once the compiler is installed, follow these steps to write and execute your first program:
Step-by-Step (Using Dev-C++):
-
Open Dev-C++
-
Click on File → New → Source File
-
Type the following code:
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
-
Save the file with a
.cextension, e.g.,hello.c -
Click on Execute → Compile & Run or press
F11
Explanation of the Program:
#include <stdio.h> // Includes standard input-output library
int main() { // Starting point of the program
printf("Hello, World!"); // Prints text to screen
return 0; // Ends the program
}
-
#include <stdio.h>– This allows us to use theprintffunction. -
int main()– The main function where the execution begins. -
printf()– Prints the message to the output screen. -
return 0;– Tells the operating system that the program ended successfully.
Congrats! You have successfully written and executed your first C program.

.png)