All pastes #975358 Raw Edit

Unnamed

public c v1 · immutable
·published 2008-04-07 14:37 UTC
rendered paste body
//estrutura usadastruct noh{   int nummat;   int idade;   char *nome;};typedef struct noh VET;///////////////////////////////     for(i = 0; i < tamanho; i++){        vet[i].nome = (char*)calloc(50, sizeof(char));        fscanf(arq, "%d %d", &(vet + i)->nummat, &(vet + i)->idade);        fgets(vet[i].nome, 50, arq);        printf("%d %d %s", (vet + i)->nummat, (vet + i)->idade, (vet + i)->nome);        }///////////////////////////////     for(i = 0; i < tamanho; i++){        (vet + i)->nome = (char*)calloc(50, sizeof(char));        fscanf(arq, "%d %d ", &(vet + i)->nummat, &(vet + i)->idade);        fscanf(arq, "%[^\n]s", (vet + i)->nome);        printf("%d %d %s", (vet + i)->nummat, (vet + i)->idade, (vet + i)->nome);        }////////////////////////////////Exemplo de arquivo:14276 18 Raphael Pereira15276 19 Carlos-1