suzy Posted December 5, 2007 at 04:56 PM Report Share #152484 Posted December 5, 2007 at 04:56 PM tenho uma estrutura que e assim 😁 struct aluno { char nome[20]; int idade; int vetor[3];// vetor com notas dos 3 periodos float media; }; como coloco valores dentro do vetor? da -me erro :S fiz assim: void inicializa(struct aluno a){ int i; printf("nome\n"); scanf("%s",&a.nome); printf("idade\n"); scanf("%d",&a.idade); for(i=0;i<3;i++){ printf(" valor %d\n",i+1); scanf("%d",&(a.vet[i])); } printf(" a media\n"); scanf("%f",&a.media); } void lista(struct aluno a){ int i; printf(" nome\n",&a.nome) printf(" idade\n",&a.idade); for(i=0;i<3;i++){ printf(" valor %d\n",i+1); printf("%d\n",a.vet[i]); } printf("%f\n",a.media); } main() { struct aluno a; inicializa(&a); lista(&a); } Link to comment Share on other sites More sharing options...
suzy Posted December 5, 2007 at 04:59 PM Author Report Share #152486 Posted December 5, 2007 at 04:59 PM :)desculpem tava aqui erros de variaveis 😁 thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now