a. | p = &p2; |
b. | p = (Person *) malloc(sizeof(Person)); |
c. | &p2 = (Person *)malloc(sizeof(Person)); p = &p2; |
d. | p = parray |
e. | p = &(parray[0]) |
a. | &p.firstname = is->fields[0]; &p.lastname = is->fields[1]; |
b. | p->firstname = is->fields[0]; p->lastname = is->fields[1]; |
c. | p->firstname = strdup(is->fields[0]); p->lastname = strdup(is->fields[1]); |
d. | *p->firstname = strdup(is->fields[0]); *p->lastname = strdup(is->fields[1]); |
e. | *p.firstname = strdup(is->fields[0]); *p.lastname = strdup(is->fields[1]); |
f. | strcpy(p->firstname, is->fields[0]); strcpy(p->lastname, is->fields[1]); |
g. | strcpy(&(p->firstname), is->fields[0]); strcpy(&(p->lastname), is->fields[1]); |
a. | p->age = is->fields[2]; |
b. | p->age = strdup(is->fields[2]); |
c. | p->age = atoi(is->fields[2]); |
d. | p->age = atoi(strdup(is->fields[2])); |
e. | sscanf(is->fields[2], "%d", &p.age); |
f. | sscanf(is->fields[2], "%d", p->age); |
g. | sscanf(is->fields[2], "%d", &p->age); |
h. | p->age = malloc(sizeof(int)); sscanf(is->fields[2], "%d", p->age); |