FREE C PROGRAMMING COURSE

Learn C Programming from Beginner to Advanced

Learn C programming step-by-step with original notes, working examples, practical programs, exercises, viva questions and beginner-friendly explanations.

Try:

25+C Programs
10Learning Areas
100%Free Learning
PracticalFocused

What Is C Programming?

C is a general-purpose, procedural programming language known for efficiency, portability and close interaction with computer memory. Learning C helps beginners understand core programming ideas such as variables, data types, expressions, selection, repetition, functions, arrays, pointers and structured data.

This site follows a practical learning path: understand the concept, study a small example, type the code yourself, run it, change it, debug errors and then solve a similar problem.

C Programming Notes & Topics

Each topic has its own crawlable page for easier learning and search.

How to Learn C Programming

  1. Start with C basics: program structure, variables, data types, input/output and operators.
  2. Learn control structures and write decision-making and loop programs.
  3. Move to arrays and strings for collections and text.
  4. Master functions before moving deeply into pointers.
  5. Finish with structures, file handling and projects.
  6. Test yourself with practical questions and viva questions.

C Programming Examples

Start with small programs and progress to arrays, strings and data structures.

Beginner01

Hello World

Concept: A simple introduction to program structure and printf().

Viva: Why is stdio.h included?

#include <stdio.h>

int main(void) {
    printf("Hello World");
    return 0;
}
Beginner02

Add Two Numbers

Concept: Variables, input and arithmetic.

Practice: Modify it to calculate average.

#include <stdio.h>

int main(void) {
    int a, b;
    printf("Enter two numbers: ");
    scanf("%d %d", &a, &b);
    printf("Sum = %d", a + b);
    return 0;
}
Beginner03

Even or Odd

Logic: n % 2 == 0 identifies an even integer.

Topic: Selection control structure.

#include <stdio.h>

int main(void) {
    int n;
    scanf("%d", &n);
    if (n % 2 == 0) printf("Even");
    else printf("Odd");
    return 0;
}
Beginner04

Positive, Negative or Zero

Concept: Multiple conditions using if...else if...else.

#include <stdio.h>

int main(void) {
    int n;
    scanf("%d", &n);
    if (n > 0) printf("Positive");
    else if (n < 0) printf("Negative");
    else printf("Zero");
    return 0;
}
Intermediate05

Check Prime Number

Logic: Test possible divisors and track whether any divides the number.

Practice: Rewrite it using a function.

#include <stdio.h>

int main(void) {
    int n, prime = 1;
    scanf("%d", &n);
    if (n < 2) prime = 0;
    for (int i = 2; i * i <= n; i++)
        if (n % i == 0) { prime = 0; break; }
    printf(prime ? "Prime" : "Not prime");
    return 0;
}
Intermediate06

Factorial of a Number

Concept: Repetition and accumulation.

#include <stdio.h>

int main(void) {
    int n;
    unsigned long long f = 1;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) f *= i;
    printf("%llu", f);
    return 0;
}
Intermediate07

Largest Element in an Array

Concept: Traverse an array and keep the current maximum.

#include <stdio.h>

int main(void) {
    int a[5], max;
    for (int i = 0; i < 5; i++) scanf("%d", &a[i]);
    max = a[0];
    for (int i = 1; i < 5; i++)
        if (a[i] > max) max = a[i];
    printf("Largest = %d", max);
    return 0;
}
Intermediate08

Find String Length

Concept: Character arrays and the standard strlen() function.

Safety: Use bounded input such as fgets() for lines.

#include <stdio.h>
#include <string.h>

int main(void) {
    char s[100];
    fgets(s, sizeof s, stdin);
    printf("Length = %zu", strlen(s));
    return 0;
}
Intermediate09

Area Using a Function

Concept: A function can accept a parameter and return a calculated value.

#include <stdio.h>

float area(float r) {
    return 3.14159f * r * r;
}

int main(void) {
    float r;
    scanf("%f", &r);
    printf("%.2f", area(r));
    return 0;
}
Advanced10

Student Record Using Structure

Concept: A structure groups related fields under one type.

#include <stdio.h>

struct Student {
    char name[50];
    int age;
    float marks;
};

int main(void) {
    struct Student s = {"Alex", 20, 78.5f};
    printf("%s %d %.1f", s.name, s.age, s.marks);
    return 0;
}

C Programming Projects

Test Your C Programming Skills

After each lesson, type the example yourself. Change inputs, alter the logic, introduce a small error and debug it. Then solve a similar problem without looking at the answer.

Open Practical Questions Practice Viva Questions

Frequently Asked Questions About C Programming

Is C programming good for beginners?

Yes. C gives beginners practice with variables, expressions, control flow, functions, arrays and memory concepts. Start with small programs and increase difficulty gradually.

How should I practice C programming?

Read a concept, type an example yourself, compile it, test different inputs, explain the logic aloud and solve a related problem without copying.

What should I learn after C basics?

Move to control structures, arrays and strings, then functions, pointers, structures and file handling. Projects help connect the topics.

Can I learn C on a phone?

You can begin with a browser-based compiler or mobile coding environment, but a computer becomes more convenient for larger multi-file projects.

Where can I find C practical and viva questions?

Use the C practical questions and C viva questions pages on this site.