you know, I think some of this stuff with structures is starting to sink in the ole noggin. I should say it is much more confusing than learning all the rules and syntax of the printf function call.
Anyhow, I have more to ask about structures....just so I know I am on the same page as the instructor (he's a transplant from Russia - so I'll never be on the same page, but ..........)
Instruction: Function is to interchange values in the dynamic variables to which p and q point, so that after the function is performed, *p will have the value formerly in *q and vice versa.
(a switcherooni so to speak).
so here is the structure again :
Code:
struct node {
char c;
struct node * next;
};
struct node *p, *q, *r;
struct node x, y, z;
and here is my code for the function described:
explain where I am wrong.
do i have to allocate memory to *p and / or *q to have this work???
Code:
void Fn1(struct node *p, struct node *q)
{
struct node temp;
temp = *p;
*p = *q;
*q = temp;
}