Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p1 = (*headcopy);
- p2 = (*headcopy)->next;
- p = (*headcopy);//sets p to the place where head is pointing
- for(i=1; i<(pokemon-1); i++){
- while(p2 != NULL){
- i = strlen(p1->name);
- j = strlen(p2->name);
- if(i>j){
- strcpy(temp->name, p1->name);
- strcpy(temp->type, p1->type);
- strcpy(temp->color, p1->color);
- strcpy(p1->name, p2->name);
- strcpy(p1->type, p2->type);
- strcpy(p1->color, p2->color);
- strcpy(p2->name, temp->name);
- strcpy(p2->type, temp->type);
- strcpy(p2->color, temp->color);
- p1 = p1->next;
- p2 = p2->next;
- }else{
- p1 = p1->next;
- p2 = p2->next;
- }
- }
- }
- if(p == NULL){
- printf("PPS is empty! Go catch 'em all!n");
- }else{
- while(p != NULL){ //condition to move p
- printf("nPokemon # %dnn", x);
- printf("Name: ");
- printf("%s n", p->name);//prints the value of name on every p
- printf("Type: ");
- printf("%s n", p->type);//prints the value of type on every p
- printf("Color: ");
- printf("%s n", p->color);//prints the value of color on every p
- printf("----------------------------------n");
- p = p->next;//moves p
- x++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement