|
|
|
@ -15,7 +15,7 @@ struct Person *Person_create(char *name, int age, int height, int weight)
|
|
|
|
|
struct Person *who = malloc(sizeof(struct Person));
|
|
|
|
|
assert(who != NULL);
|
|
|
|
|
|
|
|
|
|
who->name = strdup(name);
|
|
|
|
|
who->name = strdup((char *)name);
|
|
|
|
|
who->age = age;
|
|
|
|
|
who->height = height;
|
|
|
|
|
who->weight = weight;
|
|
|
|
@ -49,10 +49,10 @@ int main(int argc, char *argv[])
|
|
|
|
|
"Frank Blank", 20, 72, 180);
|
|
|
|
|
|
|
|
|
|
// print them out and where they are in memory
|
|
|
|
|
printf("Joe is at memory location %p:\n", joe);
|
|
|
|
|
printf("Joe is at memory location %p:\n", (void *)joe);
|
|
|
|
|
Person_print(joe);
|
|
|
|
|
|
|
|
|
|
printf("Frank is at memory location %p:\n", frank);
|
|
|
|
|
printf("Frank is at memory location %p:\n", (void *)frank);
|
|
|
|
|
Person_print(frank);
|
|
|
|
|
|
|
|
|
|
// make everyone age 20 years and print them again
|
|
|
|
|