Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

F-I-L-O Queue

Status
Not open for further replies.

Mungovan

Programmer
Oct 24, 2002
94
IE
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????


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
 
What errors do you get? the code is healthy... [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top