vendredi 30 mai 2014

[C structs]Can someone explain this code to me?


Vote count:

0




I don't really understand how the pointer to pointer works.Any way to do the same work without using pointer to pointer?



struct customer{
char name[20];
char surname[20];
int code;
float money;
};
typedef struct customer customer;
void inserts(customer **tmp)
{
*tmp = (customer*)malloc(sizeof(customer));
puts("Give me a customer name, surname code and money");
scanf("%s %s %d %f", (*tmp)->name, (*tmp)->surname, &(*tmp)->code,&(*tmp)->money);
}


asked 24 secs ago






Aucun commentaire:

Enregistrer un commentaire