C Pointers Interview Questions

C Pointer Interview Questions
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?

No comments:

Top Blogs