Frequently Asked Questions on Arrays and Pointers

Frequently Asked Questions on Arrays and Pointers, FAQ on Array and pointers, Pointers FAQ, FAQ on Array, Array Pointers interview Questions

  • I had the definition char a[6] in one source file, and in another I declared extern char *a. Why didn't it work?
  • But I heard that char a[] was identical to char *a.
  • So what is meant by the ``equivalence of pointers and arrays'' in C?
  • If they're so different, then why are array and pointer declarations interchangeable as function formal parameters?
  • So arrays are passed by reference, even though the rest of C uses pass by value?
  • Someone explained to me that arrays were really just constant pointers.
  • I'm still mystified. Is a pointer a kind of array, or is an array a kind of pointer?
  • I came across some ``joke'' code containing the ``expression'' 5["abcdef"] . How can this be legal C?
  • Since array references decay into pointers, if arr is an array, what's the difference between arr and &arr?
  • How do I declare a pointer to an array?
  • How can I set an array's size at run time?
  • How can I avoid fixed-sized arrays?
  • How can I declare local arrays of a size matching a passed-in array?
  • How can I dynamically allocate a multidimensional array?

No comments:

Post a Comment