Thread: arrays proplem
View Single Post
Join Date: Mar 2006
Posts: 176
Reputation: dubeyprateek is an unknown quantity at this point 
Solved Threads: 22
dubeyprateek's Avatar
dubeyprateek dubeyprateek is offline Offline
Junior Poster

Re: arrays proplem

 
0
  #3
Dec 28th, 2007
Once you declare an array you just reserve some amount of memory. This memory contains garbage. if you try to print all values of the array just after delaring it you will see just garbage. See folowing line of code.
  1. int alpha[50];
  2. int i = 0;
  3. for(i=0;<50;++i)
  4. {
  5. cout<<alpha[i]<<" ";
  6. }

Initialization means providing valid values to elements for the first time.
Narue's code intializes first 25 elements of the array. You can try initializing rest.
I know I am. Therefore I am.
Reply With Quote