Job Interview Questions on C Pointers
- What does *p++ do? Does it increment p or the value pointed by p?
- What is a NULL pointer? How is it different from an unitialized pointer? How is a NULL pointer defined?
- What is a null pointer assignment error?
- Does an array always get converted to a pointer? What is the difference between arr and &arr? How does one declare a pointer to an entire array?
- Is the cast to malloc() required at all?
- What does malloc() , calloc(), realloc(), free() do? What are the common problems with malloc()? Is there a way to find out how much memory a pointer was allocated?
- What's the difference between const char *p, char * const p and const char * const p?
- What is a void pointer? Why can't we perform arithmetic on a void * pointer?
- What do Segmentation fault, access violation, core dump and Bus error mean?
- What is the difference between an array of pointers and a pointer to an array?
- What is a memory leak?
- What are brk() and sbrk() used for? How are they different from malloc()?
- What is a dangling pointer? What are reference counters with respect to pointers?
- What do pointers contain?
- Is *(*(p+i)+j) is equivalent to p[i][j]? Is num[i] == i[num] == *(num + i) == *(i + num)?
- What operations are valid on pointers? When does one get the Illegal use of pointer in function error?
- What are near, far and huge pointers?
- What is the difference between malloc() and calloc()?
- Why is sizeof() an operator and not a function?
- What is an opaque pointer?
- What are the common causes of pointer bugs?