Tuesday, January 31, 2017

Important interview Questions on C pointers

• C Pointers
o What does *p++ do? Does it increment p or the value pointed by p?
o What is a NULL pointer? How is it different from an unitialized pointer?
How is a NULL pointer defined?
o What is a null pointer assignment error?
o 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?
o Is the cast to malloc() required at all?
o 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?
o What's the difference between const char *p, char * const p and const char
* const p?
o What is a void pointer? Why can't we perform arithmetic on a void *
pointer?
o What do Segmentation fault, access violation, core dump and Bus error
mean?
o What is the difference between an array of pointers and a pointer to an
array?
o What is a memory leak?
o What are brk() and sbrk() used for? How are they different from malloc()?
o What is a dangling pointer? What are reference counters with respect to
pointers?
o What do pointers contain?
o Is *(*(p+i)+j) is equivalent to p[i][j]? Is num[i] == i[num] == *(num + i)
== *(i + num)?
o What operations are valid on pointers? When does one get the Illegal use
of pointer in function error?
o What are near, far and huge pointers? New!
o What is the difference between malloc() and calloc()? New!
o Why is sizeof() an operator and not a function? New!
o What is an opaque pointer?

No comments:

Post a Comment