In this program, we are going to share a C function to Swap strings using the pointers. If you are a beginner and want to start learning the C programming, then keep your close attention in this tutorial as I am going to share a C function to Swap strings using the pointers with the output.
We have designed this program for beginners for learning purpose. Copy below c program and execute it with c compiler to see the output of the program.
void swap1(char **str1_ptr, char **str2_ptr)
char *temp = *str1_ptr;
*str1_ptr = *str2_ptr;
*str2_ptr = temp;
char *str1 = "geeks";
char *str2 = "forgeeks";
printf("str1 is %s, str2 is %s", str1, str2);
Editorial Staff at FreeWebMentor is a team of professional developers leads by Prem Tiwari View all posts by Editorial Staff