C program to swap two strings using user define function
Given two strings and we have to swap them using function in C programming language.
In this program, we are not using any library function like strcpy(), memcpy() etc, except strlen() - we can also create a function for it. But, the main aim is to swap the strings using function.
Read: C program to implement strlen() function in C
Here is the function that we are using in the program,
void swapstr(char *str1 , char *str2)
- void is the return type
- swapstr is the name of the string
- char *str1 is the character pointer that will store the address of given string1 while calling the function
- char *str2 is the another character pointer that will store the address of given string2 while calling the function
Function calling statement: