Hi.
Basically I have a first in last out queue and want to implement it on an array of size 10. I want to pust value id onto the start of the array, while pop the last value off.
The code I have sometimes gets erors. Is this corrent????
Basically I have a first in last out queue and want to implement it on an array of size 10. I want to pust value id onto the start of the array, while pop the last value off.
The code I have sometimes gets erors. Is this corrent????
Code:
//the array is of size 10 (0 to 9)
int id;
int i=9;
do{
defectArray[i]=defectArray[i-1];
i--;
}while(i>0);
defectArray[0]=id;
[\code]
Any ideas???
Thanks a million,
D