Interview Questions

What are pointers really good for, anyway?

C Interview Questions and Answers


(Continued from previous question...)

What are pointers really good for, anyway?

They're good for lots of things, such as:
* dynamically-allocated arrays
* generic access to several similar variables
* (simulated) by-reference function parameters
* malloc'ed data structures of all kinds, especially trees and linked lists
* walking over arrays (for example, while parsing strings)
* efficient, by-reference ``copies'' of arrays and structures, especially as function parameters

(Continued on next question...)

Other Interview Questions