Level 1: Problem Solving Basics

What is it? Breaking a complex problem into smaller, logical steps before writing code.

Example: Logic for Greatest of 3 Numbers

// 1. Take three numbers A, B, C
// 2. Check if A > B and A > C. If yes, A is greatest.
// 3. Check if B > A and B > C. If yes, B is greatest.
// 4. Otherwise, C is greatest.

Try This 🔥

Write an algorithm on paper to check if a number is Even or Odd.

✅ You learned this concept!

Level 2: Introduction to C

What is it? C is a foundational programming language used to build operating systems and fast software.

#include <stdio.h>

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

Explanation: #include <stdio.h> imports input/output functions. Every C program begins execution from the main() function.

Try This 🔥

Open your text console compiler interface and alter the string value to feature your own name inside the argument block.

Try in Compiler ▶

✅ You learned this concept!

Level 3: Variables and Data Types

What is it? Variables are storage containers for data. In C, you must explicitly declare a variable's data type before using it.

int age = 20;
float pi = 3.14;
char grade = 'A';

printf("Age: %d, Pi: %.2f, Grade: %c\n", age, pi, grade);

Explanation: Format specifiers like %d (integer), %f (float), and %c (character) are used inside printf to output variable data.

Try This 🔥

Create a program that calculates the area of a circle using floating-point variables.

Try in Compiler ▶

✅ You learned this concept!

Level 4: Operators

What is it? Symbols that tell the compiler to perform specific mathematical or logical manipulations.

int a = 10;
int b = 5;

int sum = a + b;
int diff = a - b;
int rem = a % b; // Modulus (remainder)

Explanation: C provides arithmetic operators (+, -, *, /, %), relational operators (==, !=, >, <), and logical operators (&&, ||, !).

Try This 🔥

Modify the code to calculate (10 + 5) * 2.

Try in Compiler ▶

✅ You learned this concept!

Level 5: Conditional Statements

What is it? Allows your program to make decisions based on conditions (True/False).

int x = 10;

if (x > 0) {
    printf("Positive");
} else {
    printf("Negative or Zero");
}

Explanation: If the condition inside the brackets (x > 0) is true, the first block runs. Otherwise, the else block runs.

Try This 🔥

Write an if-else block to check if someone is eligible to vote (age >= 18).

Try in Compiler ▶

✅ You learned this concept!

Level 6: Loops

What is it? Loops automatically run the same block of code multiple times.

for (int i = 0; i < 5; i++) {
    printf("Loop iteration: %d\n", i);
}

int count = 0;
while (count < 3) {
    printf("While loop: %d\n", count);
    count++;
}

Explanation: A for loop is used when the number of iterations is known. A while loop runs as long as the condition remains true.

Try This 🔥

Write a loop that counts down from 10 to 1.

Try in Compiler ▶

✅ You learned this concept!

Level 7: Functions

What is it? Functions are self-contained blocks of code that perform a specific task, allowing code reuse.

int calculateSquare(int side) {
    return side * side;
}

int main() {
    int result = calculateSquare(6);
    printf("Square: %d\n", result);
    return 0;
}

Explanation: The function calculateSquare takes an argument, processes it, and returns a value to the caller.

Try This 🔥

Construct a custom function to calculate the sum of two integers passed as arguments.

Try in Compiler ▶

✅ You learned this concept!

Level 8: Arrays

What is it? A single variable that holds multiple values of the exact same data type sequentially.

int arr[3] = {10, 20, 30};

for (int i = 0; i < 3; i++) {
    printf("%d\n", arr[i]);
}

Explanation: Arrays start counting at index 0. arr[0] is the first element.

Try This 🔥

Create an array of 5 numbers and calculate their total sum using a loop.

Try in Compiler ▶

✅ You learned this concept!

Level 9: Strings

What is it? A string is a 1D Array of characters that ends with a special null character (\0).

char str[10] = "Hello";
printf("%s\n", str);

Explanation: You must #include <string.h> to use functions like strlen(str) (finds length) and strcpy(dest, src) (copies string).

Try This 🔥

Write a program to input a string using scanf and print its length.

Try in Compiler ▶

✅ You learned this concept!

Level 10: Pointers

What is it? Pointers are special variables that store memory addresses of other variables.

int value = 42;
int *ptr = &value;

printf("Address: %p\n", (void*)ptr);
printf("Value at address: %d\n", *ptr);

Explanation: The reference operator & fetches raw memory addresses, while dereferencing via asterisks * accesses the value stored there.

Try This 🔥

Declare a pointer to a float variable and print its memory address.

Try in Compiler ▶

✅ You learned this concept!

Level 11: Call by Value vs Call by Reference

What is it? The two different ways to pass data into functions.

void swap(int *a, int *b) {
    int temp = *a;
    *a = *b;
    *b = temp;
}

Explanation: Call by Value passes a copy. Call by Reference passes the address using pointers, meaning the original variable gets changed.

Try This 🔥

Write a main() function to call swap(&x, &y) and print the results.

Try in Compiler ▶

✅ You learned this concept!

Level 12: Structures

What is it? A user-defined data type that groups different types of variables under a single name.

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

int main() {
    struct Student s1 = {1, "Rajan", 95.5};
    printf("ID: %d, Name: %s, Marks: %.1f\n", s1.id, s1.name, s1.marks);
    return 0;
}

Explanation: Structures are useful for representing complex entities (like a Student or an Employee) that contain multiple data points of varying types.

Try This 🔥

Create a structure for a Book containing title, author, and price, then display it.

Try in Compiler ▶

✅ You learned this concept!

Ready to test your logic?

Validate your programmatic concepts by attempting our complete logic verification assessment suite.

Start C Quiz 🚀