How do you swap strings?

Jason Tanner jtanner at jack.sns.com
Sun Jun 2 06:37:38 AEST 1991


  Is there a command to swap to elements in an array?
Currently I am using strcpy and a temporary string to swap around the 2
elements and this dosnt seem to work very well.. Swapping strings is
such an important command I cant believe that it dosnt exist.. now I am using
something like this..

  strcpy(temp,destination);
  strcpy(destination,source);
  strcpy(source,temp);

 there must be something better..

-- 
|----------------------------------------------------------------------------|
|   jtanner at jack.sns.com   -  -   Coke IS it!   - -    Knowledge = Power!!   |
|                This space was intentionally left filled.                   |
|------------------------------Dare to think!--------------------------------|



More information about the Comp.lang.c mailing list