hlpr Posted October 27, 2006 Report Share Posted October 27, 2006 Olá a todos,estou com um problemão. Esse código em C que segue, faz com que o programa termine ao executar a linhascanf("%f", &func.salario);Deem uma olhada para ver se conseguem me ajudar#include <stdio.h>#include <conio.h>struct empresa { float salario; char nome[20];};void main () { struct empresa func[20]; int i; clrscr(); for (i=0;i<1;i++) { scanf("%f", &func.salario); printf("\n\n\n %f", func.salario); } getch();} Quote Link to comment Share on other sites More sharing options...
0 Graymalkin Posted October 28, 2006 Report Share Posted October 28, 2006 Aqui funcionou perfeitamente no Dev-C++. De qualquer maneira, tente trocar...scanf("%f", &func[i].salario); ... por: scanf("%f", &(func[i].salario));Sendo que aqui funcionou *sem* esta mudança.Abraços,Graymalkin Quote Link to comment Share on other sites More sharing options...
Question
hlpr
Olá a todos,
estou com um problemão. Esse código em C que segue, faz com que o programa termine ao executar a linha
scanf("%f", &func.salario);
Deem uma olhada para ver se conseguem me ajudar
#include <stdio.h>
#include <conio.h>
struct empresa {
float salario;
char nome[20];
};
void main () {
struct empresa func[20];
int i;
clrscr();
for (i=0;i<1;i++) {
scanf("%f", &func.salario);
printf("\n\n\n %f", func.salario);
}
getch();
}
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.