C Interview Questions and Answers

 

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

Posted by:Richards