Function name : swap
Header file : <stdlib.h>
Function prototype : void swab(char *from,char *to,int n);
Function : Swap bytes from source and destination areas
Parameters : char *from and char *to are the strings to be exchanged
int n is the number of bytes to be exchanged
Return value : No return value
Program example : Use this function to exchange the string ww.wodctppc.mo into www.dotcpp.com.
#include<stdio.h>#include<stdlib.h>#include<string.h>#include<time.h>intmain(void){charsuc[20]={ww.wodctppc.mo};chardes[20] ;swab(suc,des,strlen(suc));printf(Thisisdest:%sn,des);return0;}
Running results
Thisisdest:www.dotcpp.com