- 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?
These questions are taken from Cracktheinterview Team.
1. In case of *p++,value pointed to by p is fetched first and then incremants p.
ReplyDelete14. 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 www.cracktheinterview.com
all the answers are there.
but cracktheinterview.com is not working.Do you have any idea about that ?
ReplyDeleteIf you go throgh google you can access the site and i have learnt all the
ReplyDeleteanswers from there.
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)++.
ReplyDeleteyup Rahul is right....
ReplyDeletegive ans of question of above to understaning very well.
ReplyDeleteGreat reading thiss
ReplyDelete