Reputation: 2365
struct node
{
char *ptr = (char *)malloc(frames*sizeof(char));
}*start,*current;
Then I have allocated memory equal to node
to start.
[...]//Assigned values to start node.
current = start;//Current points to start
node *temp = new node();//temp will point a newly created node
*temp = *current;// COPYING VALUES OF CURRENT TO TEMP
[...]
I want to create a new node, make temp
point to it and copy values of current
(here current is pointing to start) to temp.
BUT this is making temp point current
(here start
) instead.
Frustrated. Where am I going wrong?
Upvotes: 0
Views: 705
Reputation: 251
There could be two solutions
Upvotes: 0