- #1
torquerotates
- 207
- 0
The following code block is in C++ Everything is inside the first for loop.
for( int i=0; i<=2; i++)
{
int a[3]={0};
for(int j=0; j<3; j++)
a=j;
for( int i=0; i<=2; i++)
cout<<a;
cout<<endl;
}
basically I am trying to get the screen to output
200
020
002
I'm going this by simply erasing the a[3] array every time the first loop interates
Well it worked. Does that mean that the array a[] is reset every time the first loop iterates?
Does the memory simply vanish?
for( int i=0; i<=2; i++)
{
int a[3]={0};
for(int j=0; j<3; j++)
a=j;
for( int i=0; i<=2; i++)
cout<<a;
cout<<endl;
}
basically I am trying to get the screen to output
200
020
002
I'm going this by simply erasing the a[3] array every time the first loop interates
Well it worked. Does that mean that the array a[] is reset every time the first loop iterates?
Does the memory simply vanish?