Ok, I have two structs, and one struct is a linked list of integers, and the oth
ID: 3627264 • Letter: O
Question
Ok, I have two structs, and one struct is a linked list of integers, and the other is a struct for a binary tree. They look similar to thistypedef struct 1{
int allowedIntegers;
struct 1 *next;
} links
struct 2{
int integer
links *allowances
struct 2 *left;
struct 2 *right;
}
I just need a function that adds to the linked list. the linked list that is a member of struct 2.
I know that I would have to make a struct 2, so lets say that:
struct 2 *temp;
temp = malloc(sizeof(struct 2));
...
...
temp -> allowances.allowedInt ??? Don't really know if I'm going in the right direction
Help is appreciated.
Explanation / Answer
Dear, Function thaty adds elements in to linked list of type struct2 For example let us take integer value as 10 and allowedIntegers 5void AddElements(Struct2 *list) { struct 2 *temp;
temp = malloc(sizeof(struct 2)); cout<<" Enter value:"; cin>>temp->integer; *temp->left=list; *temp->right=null; cout<<"Enter allowed integer value:"; cin>>*temp->allowences.alloweIntegers; } Hope this will help you
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.