l'ho usato perchè foundPos è un campo di un vettore di tipo struttura ed è più comodo raggiungerlo col puntatore..
comunque il problema non è tanto in quella funzione, quanto in questa, in cui getString viene richiamata:
codice:
int rimuovere (int identifier)
{
int i;
StringPool *ptr;
if(getString(identifier) != NULL){
sp[ptr->foundPos].identificatore = -1;
strcpy(sp[ptr->foundPos].stringa, "");
return SUCCESS2;}
else{if(identifier <= 0) return ID_NOT_VALID2;
else return ID_NOT_FOUND;}
}
mentre in un'altra funzione in cui viene chiamata getString non dà nessun problema..solo in questa.
comunque ho modificato anche getString così:
codice:
int getString (int identifier)
{
int i;
StringPool *ptr;
if(identifier <= 0 ) return NULL;
else{
for(i=0;i<DIMENSIONE_VETTORE;i++){
if(sp[i].identificatore == identifier) return sp[i].stringa;
else if(i == DIMENSIONE_VETTORE -1) return NULL;}}
}