Expand|Select|Wrap|Line Numbers
- #include<iostream.h>
- int main()
- {
- int number=0;
- int A[2]={0};
- cout<<"Enter the number of elements you want in SET A"<<endl;
- cin>>number;
- for (int i=0;i<number;i++)
- {
- cout<<"Enter "<<i+1 <<" element"<<endl;
- cin>>A[i];
- }
- return 0;
- }
I debugged the program but its invain...
Actually here what i want to know is when i have given the limit of array as 2, first of all after 2 elemnts it should crash down; but then its taking garbadge value of i that's explainable to bit extent... but once the for loop is over for e.g when i take value of i as 4, how its getting executed 8 times??