Ok, part of my assignment for school is to create a struct with 2 char pointers in it. These pointers are supposed to point to a couple of dynamically allocated strings and I'm supposed to create a little function that prints the contents of the struct out. So far I have the struct:
And I have the print function:Code:typedef struct { char *name; char *number; }myStruct;
I think those two parts are right. My question is about the dynamically allocated strings that the pointers in my struct are supposed to point to. I'm not quite sure of how to do that..Code:void printMyStruct(myStruct *a, myStruct *b) { printf("%s: %s\n", *(a).name, *(b).number); }