Hi everybody!
I have a little problem with the solution of this problem:
"Given two lists, insert in a third list the pair values of the first one and the odd values of the other one."
My standard list is composed by:
-The nodes, which are structured datas formed by two datas:
a pointer and a float value;
-A pointer, which points to the first node;
-A doublepointer, which points to the pointer.
Here there is my function:
Code:
void new_pairodd (struct list **A, struct list **B, struct list **C){
if (((*A)->value)!=NULL) {
if (((*A)->value)%2 != 0){
after_add_node (C, (*A)->value);
A= &((*A)->next);
}
else{
A= &((*A)->next);
}
}
if (((*B)->value)!=NULL) {
if (((*B)->value)%2 == 0){
after_add_node (C, (*B)->value);
B= &((*B)->next);
}
else{
B= &((*B)->next);
}
}
}
I have a problem with these lines of code:
"if (((*A)->value)!=NULL)"
"if (((*A)->value)%2 != 0)"
Can anyone help me?
P.S. after_add_node is the function which creates new nodes in a list obviously.