Test Your C Skills 5th Edition by Yashavant Kanetkar (BPB Publications) is an essential self-assessment guide for mastering C programming nuances. Covering declarations, pointers, memory allocation, bitwise operators, and complicated declarations, this book uses hundreds of question-answer pairs to expose common pitfalls. Ideal for interview preparation, exam revision, and debugging practice, each chapter—from control instructions to library functions—tests conceptual clarity over rote learning. Updated for modern compilers, this edition helps programmers avoid undefined behaviour, understand const-correctness, and write robust C code. Perfect for students and professionals seeking to validate and sharpen their C language skills efficiently.
An array of 10 integer pointers. [] has higher precedence than *, so ptr is an array first, each element pointing to an integer.
Precision errors from binary representation make exact equality rare. Use a tolerance like fabs(a - b) < 1e-9 instead.
No. const prevents direct modification. Using pointer casting invokes undefined behavior, violating type safety.
It creates an alias funcPtr for a function pointer returning int and taking two int parameters, simplifying declarations.
Macro expands textually to 2+3*2+3 = 2+6+3 = 11. Use #define SQUARE(x) ((x)*(x)) for correctness.
Occurs when dynamically allocated memory (malloc) is not freed before program exits or pointer goes out of scope.
Bitwise AND (&). Result equals mask if all bits in mask are set in flags; otherwise, non-zero but less than mask.
const int *p – pointer to constant integer (value can’t change). int * const p – constant pointer (address can’t change).
String literals may be stored in read-only memory. Modifying them invokes undefined behavior, often a segmentation fault.
6. Floating addition gives 6.2, then casting to int truncates toward zero, discarding 0.2.
An array of 10 integer pointers. [] has higher precedence than *, so ptr is an array first, each element pointing to an integer.
Precision errors from binary representation make exact equality rare. Use a tolerance like fabs(a - b) < 1e-9 instead.
No. const prevents direct modification. Using pointer casting invokes undefined behavior, violating type safety.
It creates an alias funcPtr for a function pointer returning int and taking two int parameters, simplifying declarations.
Macro expands textually to 2+3*2+3 = 2+6+3 = 11. Use #define SQUARE(x) ((x)*(x)) for correctness.
Occurs when dynamically allocated memory (malloc) is not freed before program exits or pointer goes out of scope.
Bitwise AND (&). Result equals mask if all bits in mask are set in flags; otherwise, non-zero but less than mask.
const int *p – pointer to constant integer (value can’t change). int * const p – constant pointer (address can’t change).
String literals may be stored in read-only memory. Modifying them invokes undefined behavior, often a segmentation fault.
6. Floating addition gives 6.2, then casting to int truncates toward zero, discarding 0.2.