Just as a disclaimer, I am not looking for any hard code solutions, but merely a nudge in the right direction.
Essentially, I need to create a tree, that contains two arrays of data in each Node and two separate arrays of chars.
struct Node {
char *name;
char *number;
struct Node *left;
struct Node *left;
};
That's my struct at the moment, and the input is in the form:
name number
name number
name number
.
The . being the termination, now, I have a theory for how to parse that, i.e. getchar until . and scanf the name and number into an array. But from this point, I'm unsure how exactly I need to pass those arrays to a function to add the stuff to the tree, where I define the size of the array, etc. Can someone give some tips for this problem?
node->name = strdup(inputname);?