1. how exactly do i store b without overwriting it?

2. You seem to be doing this backwards. You don't seem to have any idea of what you want your function to be used for. You're just throwing random scenarios at some code and trying to make it fit. Don't you have anything in mind that it's supposed to do?

You get an idea of what you want some code to do, then you make it do it. You don't just write random test cases and try to have it fit them all without having any real goal in mind.

Quzah.

3. quzah, i tried the physical object approach (with cards labelled A,B,C) in my last post i came up with:

Code:
```charNode *temp = a;
charNode *temp2 = a->next;       temp2 is b
charNode *temp3 = b->next;        temp3 is c
a->next = b->next; /* form A, C works until here */

temp2 = temp3;```
I can't seem to store B without overwriting something

4. the strange thing is:

Code:
`a->next = b->next;`
after the above line, that's when B goes missing. I don't know how to get it back after that. Any ideas?

5. I'm still stuck on it(all day actually). Any other hints? I've tried following quzah's original code, i understand it perfectly. I can't apply the same approach to making ABC to ACB. After thinking about how to do it with 3 cards, i then try coding it only to get an endless loop or an unxpected result :|

6. Code:
```charNode *temp = a;
charNode *temp2 = a->next;       temp2 is b//actually no use of
these two temp variables
charNode *temp3 = b->next;        temp3 is c //
a->next = b->next; /* form A, C works until here */```
now your list becomes {A,C} OR {B,C}
Now your aim is {A,C,B}.how would you do it??.pointing the next of c to b and next of b to Null.

7. are you saying my code is valid up until a->next = b->next;?
Because when i print it out without the last line only 3 elements are printed.

(edit) sorry i meant 2.

8. >>are you saying my code is valid up until a->next = b->next;?
yeah.

>>Because when i print it out without the last line only 3 elements are printed.
You are passing three elements a,b,c.your b is lost what are the 3 elements printed.n foremost how you are printing?

9. ok, at least i got it to print A,C,B but D is missing

10. Originally Posted by Axel
ok, at least i got it to print A,C,B but D is missing
thats beacause you set c->next to b which was earlier d.now you lost d.so make a statement atlast which does b->next = d.

11. i tried b->next = a->next->next->next which gives an endless loop unless i put a NULL. I think i have to set the last element in the list to NULL?

12. my print function is something like:
Code:
``` while (start != NULL )
{
printf("\n %d %c %.2f %.2f\n", element , start->cityname, start->numberone,    start->numbertwo);
}```

13. n/m finally got it thanks!

14. programming is little different from chemistry.One should make the diagram of variable on a notebook and see how pointers are moving instead of hit and trial method untill v get feeling of
EUREKA

15. ok it doesn't seem like what i wanted. Say if i had

A, B, C, D, E

swap the two.

A, C, B, D, E

if the IF evaluates to true then everything is OK. Continue on...

go to D and E swap it.

A, C, B, E, D

The if evaluates to false so i need to unswap it.

A, C, B, D, E

at the moment here's what happens ( i have a while loop which just goes and runs the swap function till it hits the end)

A,B,C,D,E
A,C,B,D,E
A,C,D,B,E
A,C,D,E,B

i somehow need to UNSWAP if the if condition evaluates to false. Any hints ?