IT Placement Papers Programming C
This category contains C Interview Questions and Answers |
What is the difference between arrays and Pointers?
|
|
|
|
|
Arrays automatically allocate space, but can't be relocated or
resized. Pointers must be explicitly assigned to point to
allocated space (perhaps using malloc), but can be reassigned
(i.e. pointed at different objects) at will, and have many other
uses besides serving as the base of blocks of memory.
Due to the so-called equivalence of arrays and pointers , arrays and pointers often seem interchangeable,
and in particular a pointer to a block of memory assigned by
malloc is frequently treated (and can be referenced using [ ])
exactly as if it were a true array.
Only registered users can write comments. Please login or register.
|