1
My question is, what is the error of this passage? It seems that the passage (*dadosCliente+i)
is incorrect, someone knows why?
struct cliente{
char nome[50];
char endereco[50];
}
void addCliente(struct cliente *dadosCliente, int *i){
printf("qual o nome do cliente?");
scanf(" %s", (*dadosCliente+i).nome);
printf("qual o endereço do cliente?");
scanf(" %s", (*dadosCliente+i).endereco);
*i=*i+1;
}
void main(){
int i=0,h=0;
struct cliente clientes[1000];
while(h!=1){
printf("Caso queira sair do cadastro digite 1");
addCliente(clientes, &i);
}
}
Can you be more specific? What you expected to happen that isn’t happening?
– C. E. Gesser
(*dataClient+i) appears to be incorrect.
– Nicolas Bontempo
Welcome to Stack Overflow in English, we are a question and answer site. In order to be able to better answer your question, you could improve your question a little more?
– Felipe Avelar
I edited it out.
– Nicolas Bontempo
When asking a question about a mistake, remember to tell exactly what the mistake is. If the behavior is unexpected, tell us what you expected and what you got. If there was a compilation error (probably your case), please inform the diagnostic message.
– Guilherme Bernal