Tuesday, July 28, 2009

When declaring an array in C, do you have to initialize the array immediately? Why or why not?

No, because it can be done later.

When declaring an array in C, do you have to initialize the array immediately? Why or why not?
no, you're declaring a variable to hold the place in memory where the elements of the array will be stored. The array is reserved a chunk of memory that you can fill whenever you want. It's important to remember though that C necisarilly stop you from putting more elements in an array than it is meant to hold, creating an overflow.


No comments:

Post a Comment