Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- struct el_listy1{
- char slowo[20];
- struct el_listy1 *next;
- };
- struct el_listy2{
- char slowo[20];
- int czestosc;
- struct el_listy2 *next;
- };
- struct el_listy2 *przepisz(struct el_listy1 *lista){
- struct el_listy2 *poczatek=NULL, *e=NULL, *koniec=NULL, *nowy;
- while(lista!=NULL){
- e=poczatek;
- while(e!=NULL){
- if(strcmp(e->slowo, lista->slowo)==0){
- e->czestosc++;
- break;
- }
- e=e->next;
- }
- if(e==NULL){
- nowy=(struct el_listy2 *)malloc(sizeof(struct el_listy2));
- nowy->next=NULL;
- strcpy(nowy->slowo, lista->slowo);
- nowy->czestosc=1;
- if(poczatek==NULL){
- poczatek=nowy;
- koniec=nowy;
- }
- else{
- koniec->next=nowy;
- koniec=nowy;
- }
- }
- lista=lista->next;
- }
- return poczatek;
- }
- int main(){
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement