Enviado em 06/12/2019 - 16:08h
Boa tarde, estou fazendo um exemplo simples para entender um struct de structs, meu objeto e criar um vetor ou uma lista de strcuts. porem este erro aparece#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio_ext.h>
struct cliente
{
unsigned int codigo;
char nome[41];
char cpf[11];
//struct cliente *prox;
};
typedef struct cliente TCliente;
struct lista_clientes
{
int capacidade;
int num_cliente;
TCliente *clientes;
};
typedef struct lista_cliente tlista;
int main()
{
char op;
tlista *l;
unsigned int codigo;
char nome[41];
char cpf[14];
l = malloc(sizeof(tlista));
if(l == NULL)
{
printf("Erro, possivel falta de memoria\n\n");
//return -1;
}
do
{
printf("\nCadastrar:\n");
printf("\n\nCodigo: ");
scanf("%u", &codigo);
l->clientes.codigo = codigo;
printf("\n\nNome: ");
fflush(stdin);
fgets(nome, 41, stdin);
strcpy(l->clientes.nome, nome);
printf("\n\nCPF: ");
fflush(stdin);
fgets(cpf, 14, stdin);
strcpy(l->clientes.cpf, cpf);
printf("\n\nContinua [S/N] ?");
scanf(" %c", &op);
}while(op == 'S' || op == 's');
__fpurge(stdin);
return 0;
}
Como gerar um podcast a partir de um livro em PDF
Automatizando digitação de códigos 2FA no browser
Resolver problemas de Internet
Como compartilhar a tela do Ubuntu com uma Smart TV (LG, Samsung, etc.)
Como Instalar o Microsoft Teams no Linux Ubuntu
Músicas de Andrew Hulshult no DOOM (WAD)
Instalar o Apache, MySQL e PHP no Oracle Linux 8
Bloqueando telemetria no Deepin 23.1
Como converter imagens PNG/JPEG para SVG em linha de comando