I'm trying to call two functions, the first function will receive data and the second will show the data. But my second function is equal to the first, so it doesn't do what I intend to do. Any suggestions guys?
struct Operador
{
char nome[32];
char telefone[15];
char idade[3];
};
struct Operador* fun( ) {
struct Operador* pItems = malloc( 3 * sizeof(struct Operador));
int n;
for(n=0;n<1;n++){
printf(" name: "); gets(pItems[n].nome);
printf(" telefone: "); gets(pItems[n].telefone);
printf(" age: "); gets(pItems[n].idade);
}
return pItems;
}
//*-*-**-*-*-*-*-*-*-*-*-*-*-*-*-*-*--*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-**-*fim_operador
void lo()
{
struct Operador* pItems =fun();
int j;
printf("\n\n");
for(j=0;j<1;j++){
printf(pItems[j].nome);
printf(pItems[j].telefone);
printf(pItems[j].idade);
printf("\n\n");
}
free(pItems);
}
main()
{
fun();
lo();/ i want this function to simply display data