i'm confused. What's wrong with your suggestion? Why would you need to allocate 'temp' if you're swapping the value (a number) at the location? 'A' and 'B' already exist somewhere.
Quoting John <[email protected]>: > --- In [email protected], Benjamin Scott > <benjamin_cail_sc...@...> wrote: >> >> You can always use the following. >> Â >> Void Swap(Void *A, void *B) >> { >> Void *Temp >> >> Temp = A >> A = B >> B = temp >> }; > > Did you mean something like: > > *temp = *A > *A = *B > *B = *temp > > I hope not, because apart from not allocating memory for *temp, it is > never going to work because you cannot dereference a void pointer. > > Please try compiling your code before posting. > > [Non-text portions of this message have been removed]
