Ciao a tutti!!
ho un esercizio che... Non gira bene ;/


codice:
#include <stdio.h>
#include <stdlib.h>



struct data {
    char a[1000];
    struct data *next;
};
struct data *crea(){
    struct data *head, *pointer;
    printf("Aggiungi un elemento\n");
    head=(struct data*)malloc(sizeof(struct data));
    scanf("%s",head->a);
    pointer=head;
    return head;
}


void cerca(struct data *cerc){
    int i=0;
    char f[1000];
    printf("quale elemento vui cercare");
    scanf("%s",f);
    while(cerc!=NULL){
        if(cerc->a==f){
            i=i+1;
            
        }
         cerc=cerc->next;
    }
    printf("L'elemento e' stato trovato %d volta/e\n", i);
}


int main() {
    struct data *lista;
    int l=0;
    while (l>=0&&l<=4) {
        printf("1. crea lista\n2. cerca elemento\n");
        scanf("%d",&l);
        switch(l){
                break;
            case 1:
                lista=crea();
                break;
            case 2:
               cerca(lista);
                break;
            
        }
    }
    
    system("pause");
    return 0;
}