Skill Zuno · skillzunos.com · Fullstack
C interview questions
Prepare for C interviews on Skill Zuno. This practice book covers C interview questions across New, Easy, Medium, Hard, and Diff levels so you can work through real interview-style problems on skillzunos.com.
Open C on Skill ZunoAlso see the C tutorial.
C is a small, compiled, procedural language that maps closely to the hardware. Operating systems, embedded firmware, databases and language runtimes are written in it. C interviews focus on pointers, memory management, arrays and strings, structs, the preprocessor and undefined behaviour.
Sample C interview questions
What is the difference between malloc and calloc?
malloc(size) allocates uninitialised memory. calloc(count, size) allocates memory for count elements and sets every byte to zero, and it checks the multiplication for overflow.
What is a dangling pointer?
A pointer that still holds the address of memory that has been freed or of a local variable that went out of scope. Dereferencing it is undefined behaviour. Set pointers to NULL after free to make reuse easy to detect.
What does static mean in C?
Inside a function, a static variable keeps its value between calls. At file scope, static gives a variable or function internal linkage, so it is invisible to other source files.
What is the difference between an array and a pointer?
An array is a block of elements and sizeof gives its full size. In most expressions it decays to a pointer to its first element, so sizeof inside a function that receives it gives only the pointer size.
Why are macros risky?
Macros are text substitution with no type checking. #define SQUARE(x) x*x gives the wrong result for SQUARE(a+1), and arguments with side effects can be evaluated twice. Wrap parameters in parentheses or use inline functions.
What you can practice
- C interview questions for beginners and experienced developers
- Level-based practice: New, Easy, Medium, Hard, and Diff
- Fullstack topics alongside C on skillzunos.com