describe each lines for each functions
#include
/*Method to find the length of String*/
int str_len(char str[])
{
int i=0;
int stringLength=0;
while(str[i]!='\0')
{
stringLength+=1;
i++;
}
return stringLength;
}
/*Method to reverse string in iterative manner*/
void simpleReverse(char* str)
{
int stringLength=str_len(str);
 Â
for(int i=0;i{
char temp=str[i];
str[i]=str[stringLength-i-1];
str[stringLength-i-1]=temp;
}
}
/*Method to reverse string in iterative manner*/
void recursiveReverse(char str[], int start, int end)
{
if( start < end )
{
//swap
char temp = str[start];
str[start] = str[end];
str[end] = temp;
recursiveReverse(str, ++start, --end);
}
}
/*Method to print string*/
void printString(char str[])
{
int i=0;
while(str[i]!='\0')
{
printf(\"%c\",str[i]);
i++;
}
printf(\"\n\");
}
int main()
{
/*
Part 1: Storing a String
*/
char buffer1[]={'t','h','i','s',' ','i','s',' ','t','h','e','','f','i','r','s','t',' ','b','u','f','f','e','r','\0'};
char buffer2[]={'t','h','i','s',' ','i','s',' ','t','h','e','','s','e','c','o','n','d',' ','b','u','f','f','e','r','\0'};
char buffer3[80];
/*User Input to string using scanf() and format specifier:%s*
scanf(\"%s\",&buffer3) only accepts string till first space isencountered space
scanf(\" %[^ ]s\",&buffer3) for string with space
*/
scanf(\"%s\",&buffer3); /**/
 Â
 Â
/*Part 2: assigning pointer to array*/
char *pBuffer=buffer3;
printString(buffer3);
 Â
/*Part 3*/
/*Buffer 3 before reversing*/
printf(\"String before reversing: \n\");
printString(buffer3);
/*Reversing buffer3 using simpleReverse():Iterative Method*/
simpleReverse(buffer3);
/*Data of string is changed in memory.*/
printf(\" String After Reversing \n\");
/*Buffer 3 after reversing*/
printString(buffer3);
 Â
 Â
printf(\" String Reverse Using Recursion: \n\");
 Â
/*Reversing buffer2 using recursive approach*/
printf(\" String before reversing: \n\");
printString(buffer2);
/*Reversing String */
recursiveReverse(buffer2,0,str_len(buffer2)-1);
/*Data of string is changed in memory.*/
printf(\" String after Reverse: \n\");
printString(buffer2);
 Â
return 0;
}