Salve a tutti, ho un problema riguardante Pelles C.
Questo è un semplice esercizio sulle strutture, ma non riesco a compilare perchè mi dà questi errori:
1) warning #2145: Assignment of 'struct studente *' to '(incomplete) struct studente *'
2) error #2120: Redeclaration of 'inserisci', previously declared at C:\Users\Alessia\Documents\Pelles C Projects\gioco.c(8); expected 'void __cdecl function(int, (incomplete) struct studente *)' but found 'void __cdecl function(int, struct studente *)'.
L'esercizio riguarda solamente l'inserimento e la stampa del Nome,Cognome, e Voto di 3 studenti.Questo è il codice:
Grazie in anticipo!!!codice:#include <stdio.h> #include <stdlib.h> #define LEN_NAME 10 #define LEN_COGN 20 #define N 3 //numero degli studenti da inserire void inserisci(int n, struct studente v[]); void stampa(int n, struct studente v[]); struct studente { char nome[LEN_NOME+1]; char cognome[LEN_COGN+1]; int voto; }; int main(void) { struct studente vett[N]; //vettore di struttura dove inserisco nome,cognome e voto dei 3 studenti inserisci(N,vett); stampa(N,vett); return 0; } //-------Funzione inserisci()---------------- void inserisci(int n, struct studente v[]) { int i; for(i=0; i<=N; i++) { printf("Nome, Cognome, Voto\n"); scanf("%s\n", v[i].nome); scanf("%s\n",v[i].cognome); scanf("%d\n",&v[i].voto); } } //--------Funzione stampa()--------------------------- void stampa(int n, struct studente v[]) { int i; for(i=0; i<=N; i++) { printf("%s\t%s\t%d\n", v[i].nome,v[i].cognome,v[i].voto); } }
CIAO

Rispondi quotando