← Learn
C2 min read·22 Oct 2026

C programming: pointers, arrays and the 12 programs every exam asks

C is the first language for most engineering students and the first place they get stuck. Here is what the paper actually wants.

HCHandwrittenCode team
Study Delight Publications, Delhi
C programming: pointers, arrays and the 12 programs every exam asks

C is on every engineering syllabus for a reason: it teaches what the computer is really doing. It is also where most first-years lose marks, because the paper tests three things most tutorials skip — memory, pointers and output tracing.

What the C paper is made of

  • Output questions (20–30%) — "What is the output of the following code?" Usually about ++i vs i++, integer division, printf format specifiers and pointer arithmetic.
  • Write-a-program questions (30–40%) — the same dozen programs rotate every year (list below).
  • Theory (30%) — storage classes, call by value vs reference, structures vs unions, malloc vs calloc.

Pointers in one paragraph

A pointer is a variable that stores an address. int *p = &x; means "p holds where x lives". *p reads or writes the value at that address. Arrays are pointers in disguise: a[i] is exactly *(a + i). Once that clicks, strings (char *), passing arrays to functions and dynamic memory all become the same idea.

#include <stdio.h>
int main() {
    int a[] = {10, 20, 30};
    int *p = a;
    printf("%d %d\n", *p, *(p + 2));   // 10 30
    p++;
    printf("%d\n", *p);               // 20
    return 0;
}

The 12 programs that keep coming back

  1. Reverse a number / check palindrome
  2. Prime numbers in a range
  3. Factorial and Fibonacci (loop and recursion — both get asked)
  4. Armstrong number
  5. Swap two numbers using pointers (call by reference)
  6. Largest element in an array
  7. Bubble sort
  8. Linear and binary search
  9. Matrix addition and multiplication
  10. String reverse / palindrome without strrev
  11. Count vowels, words and characters in a string
  12. Student record with a struct and an array of structures

Three mistakes that cost the most marks

  • Forgetting & in scanf("%d", &n); — it compiles, then crashes.
  • 5 / 2 is 2, not 2.5. Make one operand a float.
  • Writing if (x = 5) instead of if (x == 5) — always true, always wrong.

How to revise C in a week

Days 1–2: basics, operators, control flow, and tracing output by hand. Days 3–4: arrays, strings, functions. Day 5: pointers (the whole day). Day 6: structures, files, dynamic memory. Day 7: write the 12 programs from memory, no book open.

The C Simplified Handwritten Notes cover these in 108 colour pages, with the pointer diagrams drawn out box by box and the output printed beside every program.