What is C Programming? Introduction to C Language

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

  1. Earlier languages such as BCPL and B influenced the design of C.
  2. Dennis Ritchie developed C at Bell Labs around 1972.
  3. C was used heavily in the development of the UNIX operating system.
  4. Because C was efficient and portable, it spread to many computers and operating systems.
  5. 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.

Easy Tip

EASY TIP: Think of C as a language that teaches you what is happening inside the computer, not only how to get an answer.

Exam Point

Dennis Ritchie is the key name to remember for the development of C.

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

Easy Tip

C is called a middle-level language because it supports both high-level programming and low-level operations.

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

  1. Install a GCC toolchain such as MinGW-w64.
  2. After installation, make sure the compiler’s bin folder is available in PATH.
  3. Open Command Prompt.
  4. Type the following command:

gcc --version

5. 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 hello

Run it. On Windows, the executable is normally hello.exe. On Linux/macOS, you can usually run:

./hello
OUTPUT:
Hello, C!

Easy Tip

An IDE such as Code::Blocks or Visual Studio Code is an editor/development environment. The actual compilation is done by a compiler such as GCC.

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!

Exam Point

A statement in C generally ends with a semicolon (;).

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 program

Easy Tip

If your program has a syntax error, compilation normally stops and the compiler reports the problem. Fix the error and compile again.

printf() 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

SpecifierMeaningExample
%dintegerprintf(“%d”, age);
%ffloating-point valueprintf(“%.2f”, price);
%csingle characterprintf(“%c”, grade);
%sstringprintf(“%s”, name);
%lfdouble 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

Easy Tip

Notice the space before %c in scanf(” %c”, &grade). It helps skip whitespace left in the input stream.

Scroll to Top