C Programming · Interview question

What is a pointer, really?

A strong answer

A pointer is a variable whose value is a memory address. It's typed, an int * holds the address of an int, and that type determines how many bytes a dereference reads and how pointer arithmetic scales. The two fundamental operations are & (address-of, which produces a pointer to a variable) and * (dereference, which accesses the value living at that address, for both reading and writing). The pointer itself occupies storage like any variable, typically 4 bytes on a 32-bit target, 8 on 64-bit, independent of the size of what it points to.

What a weak answer sounds like

You know the answer. Do you know what gets you dinged?

Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.

From the lesson

Pointers & Addresses

A pointer is just a variable that holds an address. Master & and *, NULL, and how passing a pointer lets a function reach back and modify the caller's data.

More Pointers & Addresses questions

Browse all 472 interview questions