-1
The program is about a bank, I need two structs (one of client and one of accounts), the account holder has to be linked with some client. But in the Add_account function, I am not able to make this link, I need a way to point to the place where the client is registered, or any suggestion of how I could do. Later I will need to print the clients of an agency, so I would need to filter data from the two structs.
//Declara��o structs - Cliente e Conta
typedef struct
{
char nome[100];
int RG;
char endereco[200];
int telefone;
float renda;
int tipo_cliente; //1-private, 2-alta renda, 3-varejo
union
{
int cpf;
int cnpj;
} cpf_cnpj;
int num_cl;
} Cliente;
Cliente cliente[MAX_CLIENTES];
char nome[100];
char endereco[200];
int posicao;
typedef struct
{
int Numero_Conta; //deve ser unico e gerado pelo programa
int Agencia;
float Saldo_Conta;
int Tipo_Conta; // 1- Conta corrente 2-Conta poupanca 3- conta-salario
struct Cliente *Titular; // titulares (deve estar vinculado aos clientes cadastrados)
} Dados_Contas;
Dados_Contas contas[MAX_CLIENTES];
void Add_Conta(int j, int num)
{
int id;
printf("Preencha os dados a seguir: \n \n");
printf("Agencia: \n");
scanf("%d%*c", &contas[j].Agencia);
contas[j].Numero_Conta = num;
printf("O sistema definiu o seguinte numero para a conta: %d \n", num);
printf("Saldo da conta: \n");
scanf("%f%*c", &contas[j].Saldo_Conta);
printf("Tipo da conta: \n 1- CONTA-CORRENTE \n 2- CONTA POUPANCA \n 3- CONTA-SALARIO \n");
scanf("%d%*c", &contas[j].Tipo_Conta);
printf("Qual o numero (identificador) do cliente titular? ");
scanf("%d", &id);
// contas[id]->Titular=&cliente[id];1
}
```
Post a complete program, something compilable. Help others help you... In your Client program is a structure. A name. And so customer is Customers[MAX_CLIENTES]; so declaring Holder as a pointer to a Customer is not a struct. Use only Customer* Holder
– arfneto
Next time I put the full code, thank you for your help!
– Palloma Tiba