All pastes #885220 Raw Edit

Jemand

public text v1 · immutable
#885220 ·published 2008-01-30 20:31 UTC
rendered paste body
P_BLOCK my_ausketten_by_id(P_BLOCK *pListe,int id){
	int i,max;
	P_BLOCK hptr,lz=*pListe;
	max = my_block_count(*pListe);

	if(*pListe==(P_BLOCK)NULL)
		return (P_BLOCK)NULL;

	if(id<1 || id>max)
		return (P_BLOCK)NULL;

	if(id==1){							//vorne ausketten
		hptr=*pListe;
		*pListe = (*pListe)->pNext ;
		return hptr;
	}
	
	for(i=1;i<(id-1);i++)
		lz = lz->pNext ;
	hptr = lz->pNext ;
	lz->pNext = lz->pNext->pNext;
	return hptr;
}


int my_block_count(P_BLOCK pListe){
	int zaehler=0;
	for(pListe;pListe!=(P_BLOCK)NULL;pListe=pListe->pNext )
		zaehler++;
	return zaehler;
}