If an array name acts like a pointer to the base of an array ...
C Interview Questions and Answers
(Continued from previous question...)
If an array name acts like a pointer to the base of an array ...
Q: If an array name acts like a pointer to the base of an array, why isn't the same thing true of a structure?
A:The rule that causes array references to ``decay'' into pointers is a special case which applies only to arrays, and reflects their ``second class'' status in C. (An analogous rule applies to functions.) Structures, however, are first class objects: when you mention a structure, you get the entire structure.
(Continued on next question...)
Other Interview Questions
|