I'm trying to swap to values using pointers to point to the address of my variables. Please note that I know you have to use &theseed when seeding the values.
however why doesn't my function work? Why is itemp refusing to store the value of ix? (I thought after I had stored my variable to the pointer, I would be working exclusively with the stored variable)
1 2 3 4 5 6 7 8
void Swap_real(int* ix, int* ix2)
{
int itemp;
itemp = ix;
ix = ix2;
ix2 = itemp;
}
Seeded into the pointer? With the possible exception of dynamically allocated memory pointers don't hold data, they just point to the variable you told it to. All your function would do when you get it working is make ix point to what ever ix2 was pointing at and vica versa. It would be much simpler to just change what each one is pointed at. Unless, like I said above, they are dynamically allocated.