Skip to main content
Jai Hind Students
Join free
All lessons
Computer ScienceBeginnerB.TechC ProgrammingJNTUFirst Year

Pointers in C for first-year B.Tech - from a second-year who struggled

Pointers explained with the house-address analogy, plus the five exam questions JNTU loves to repeat.

Kiran Tej, JNTU Kakinada 18 min read

The analogy

A variable is a house. A pointer is a piece of paper with the house address written on it. & reads the address. * walks to the house.

Five JNTU favourites

  1. Swap two numbers using pointers.
  2. Pointer arithmetic on arrays.
  3. Difference between int *p and int **p.
  4. Pass-by-value vs pass-by-reference.
  5. Dangling pointers and why free() matters.

Code you should type, not copy

int a = 10;
int *p = &a;
printf("%d", *p); // 10

Honest advice

I failed my first internal on this. What fixed it was drawing boxes and arrows for every program. Do that for a week.

More in Computer Science