typedef struct {
char product_id[10];
double price;
int yr,mm,dd,hr,min,sec;
int flag;
} purchase_t;
void
read_purchases(purchase_t *purchase[], int *num_purchase){
int c;
while ((c=getchar()) != EOF){
purchase_t *new = malloc(sizeof(purchase_t));
scanf("%s", new->product_id);
scanf("lf",&new->price);
***** scanf("%d:%d:%d:%d:%d:%d",&new->yr,&new->mm,&new->dd,&new->hr,&new->min,&new->sec);
scanf("%d",&new->flag);
int i;
for (i=strlen(new->product_id); i>=0; i--){
new->product_id)[i+1] = new->product_id[i];
}
new->product_id[0] = c;
purchase[*num_purchase] = new;
*num_purchase += 1;
}
}
Is there a simpler way you approach line ***** or should I stick with this approach? P.S The program does the required job