Job Interview Questions on C Pointers

  1. What does *p++ do? Does it increment p or the value pointed by p?

  2. What is a NULL pointer? How is it different from an unitialized pointer? How is a NULL pointer defined?

  3. What is a null pointer assignment error?

  4. 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?

  5. Is the cast to malloc() required at all?

  6. 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?

  7. What's the difference between const char *p, char * const p and const char * const p?

  8. What is a void pointer? Why can't we perform arithmetic on a void * pointer?

  9. What do Segmentation fault, access violation, core dump and Bus error mean?

  10. What is the difference between an array of pointers and a pointer to an array?

  11. What is a memory leak?

  12. What are brk() and sbrk() used for? How are they different from malloc()?

  13. What is a dangling pointer? What are reference counters with respect to pointers?

  14. What do pointers contain?

  15. Is *(*(p+i)+j) is equivalent to p[i][j]? Is num[i] == i[num] == *(num + i) == *(i + num)?

  16. What operations are valid on pointers? When does one get the Illegal use of pointer in function error?

  17. What are near, far and huge pointers?

  18. What is the difference between malloc() and calloc()?

  19. Why is sizeof() an operator and not a function?

  20. What is an opaque pointer?

  21. What are the common causes of pointer bugs?

These questions are taken from Cracktheinterview Team.


  1. 1. In case of *p++,value pointed to by p is fetched first and then incremants p.

    14. ponter contains the address of another variable.

    15. ya,they all are equivalent.

    18. malloc()allocates one block of memory.
    calloc() allocates more than one block of memory.

    go to
    all the answers are there.

  2. but is not working.Do you have any idea about that ?

  3. If you go throgh google you can access the site and i have learnt all the
    answers from there.

  4. 1. associativity of * and ++ moves from right to left,so it will first increment pointer and then fetch the value.if you want to do reverse use (*p)++.

  5. give ans of question of above to understaning very well.