All pastes #41426 Raw Edit

Untitled

public text v1 · immutable
#41426 ·published 2006-02-13 13:55 UTC
rendered paste body
struct phonebook {
	char *username,*region;
	int code,time,used;
	struct phonebook *nxt;
};

struct phonebook *find (const char *username) {
	struct phonebook *l;
	for (l=root; (l!=NULL) && strcmp(l->username,username)!=0; l=l->nxt) {
	}
	return(l);
}

int list_insert(const char *username,const char *region,const int time) {
    int a=1;
    struct phonebook *l,*ptr;
	l=find(*username); <============= [Warning] passing arg 1 of `find' from incompatible pointer type 
	if (l!=NULL) {
	    printf("This name allready exists!\n");
	    return(0);
	}
	l=(struct phonebook *)malloc(sizeof(struct phonebook));
	if (l==NULL) {
	    printf("Memory Error!\n");
		return(0);
	}
	do {
	    ptr=find_code(a);
	    if (ptr==NULL) {
	        break;
	    }
        a++;
    }while (ptr!=NULL);
    l->username=username;
    l->region=region;
    l->code=a;
    l->time=time;
    l->nxt=root;
    root=l;
    return(1);
}