function definition with structure node
I need to write a definition of a function with all the following points to be addressed:
- function name is Problem
- it receives a parameter named b of the struct node * type
- it creates a new dynamic variable with "p" pointing to it and with contents the same as those of the node to which "b" points to
- it returns the address of the newly created code
not sure if I have this right, please critique as necessary:
Code:
void Problem(struct node * b)
{
struct node * p = (struct node *) malloc (sizeof (struct node));
p = b;
returns p;
}