What is C Programming
C is a general-purpose programming language. It was developed by Dennis Ritchie at Bell Laboratories in the early 1970s. C became popular because it is fast, flexible and gives programmers good control over computer memory.
How C developed — in simple words
- Earlier languages such as BCPL and B influenced the design of C.
- Dennis Ritchie developed C at Bell Labs around 1972.
- C was used heavily in the development of the UNIX operating system.
- Because C was efficient and portable, it spread to many computers and operating systems.
- The language was later standardized so that programs could be written more consistently across systems.
Why should we learn C?
- C teaches the basic ideas behind programming: variables, conditions, loops, functions, arrays and memory.
- Many later languages were influenced by C syntax.
- C is still used in operating systems, embedded systems, compilers and performance-sensitive software.
Features of C
A feature is a useful quality of a programming language. C has many features that make it important even today.
- Simple – The core language has a relatively small set of concepts and keywords.
- Fast – C programs are compiled into efficient machine-level code.
- Portable – The same source code can often be compiled on different systems with limited changes.
- Structured – Large programs can be divided into functions and logical blocks.
- Case-sensitive – age, Age and AGE are different identifiers.
- Rich operators – C provides arithmetic, relational, logical, bitwise and assignment operators.
- Pointers – C can work directly with memory addresses through pointers.
- Extensible – Programmers can create functions and reusable modules.
- Middle-level – C combines high-level programming features with low-level memory cont
How To install C
To run a C program, you need a C compiler. GCC is one of the most commonly used C compilers.
Method 1: GCC on Windows
- Install a GCC toolchain such as MinGW-w64.
- After installation, make sure the compiler’s bin folder is available in PATH.
- Open Command Prompt.
- Type the following command:
gcc --version5. If a GCC version appears, the compiler is ready.
Create and run your first file
hello.c
#include <stdio.h>
int main() {
printf("Hello, C!");
return 0;
}Save the file as hello.c. Then compile it:
gcc hello.c -o helloRun it. On Windows, the executable is normally hello.exe. On Linux/macOS, you can usually run:
./helloOUTPUT:
Hello, C!First C Program
Let us understand the most common beginner program. Do not just memorize it—understand what each line does.
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}Line-by-line explanation
#include <stdio.h> → Adds declarations for standard input/output functions such as printf().
int main() → Defines the main function. Program execution starts from main().
{ } → Marks the beginning and end of the function body.
printf(“Hello, World!”); → Displays the message on the screen.
return 0; → Ends main and commonly indicates successful completion.
OUTPUT
Hello, World!Compilation Process in C
The computer cannot directly execute normal C source code. The source code goes through several stages before an executable program is produced.
1. Source Code → The programmer writes a .c file.
2. Preprocessing → #include, #define and other preprocessor directives are handled.
3. Compilation → The C source is translated and checked for C language rules.
4. Assembly → Assembly instructions are converted into object/machine code.
5. Linking → Object code is combined with required library code to create an executable.
6. Execution → The operating system loads and runs the executable.
Example GCC command
gcc program.c -o programprintf() and scanf()
These two functions are used in many beginner C programs. printf() is mainly used to display output, while scanf() is commonly used to read formatted input.
printf() — display output
int age = 20;
printf("Age = %d", age);Important format specifiers
| Specifier | Meaning | Example |
| %d | integer | printf(“%d”, age); |
| %f | floating-point value | printf(“%.2f”, price); |
| %c | single character | printf(“%c”, grade); |
| %s | string | printf(“%s”, name); |
| %lf | double with scanf() | scanf(“%lf”, &value); |
scanf() — take input
int age;
printf("Enter age: ");
scanf("%d", &age);The & before a normal variable gives its address. scanf() uses that address to store the input value.
Complete program
#include <stdio.h>
int main() {
int age;
float marks;
char grade;
printf("Enter age: ");
scanf("%d", &age);
printf("Enter marks: ");
scanf("%f", &marks);
printf("Enter grade: ");
scanf(" %c", &grade);
printf("\nAge = %d", age);
printf("\nMarks = %.2f", marks);
printf("\nGrade = %c", grade);
return 0;
}OUTPUT
Enter age: 21
Enter marks: 87.5
Enter grade: A
Age = 21
Marks = 87.50
Grade = A