#include #include #include #include void swap(char *s1, char *s2); void format(int sec); void soundfor(int sec); void catenate(char *s1, char *s2, int j); void reverse(char *s1, int j); int endof(char *strg); void main(void) { char *str1; char *str2; str1=(char*)malloc(80*sizeof(char)); str2=(char*)malloc(80*sizeof(char)); int j=0; char choice='c'; label: //needed as a return point clrscr(); printf("\nEnter the type of string function: C: Concatenation R: Reverse"); printf(" B: Both Concatenation & reversing (concatenation first) \n"); choice = getch(); switch(choice) { case 'r': case 'R': //REVERSE The string { printf("\nEnter the String \n"); gets(str1); j=endof(str1)-1; reverse(str1, j); printf("\nThe Reversed String is \n%s",str1); delay(500); break; } case 'c': case 'C': { printf("\nEnter String 1 \n"); gets(str1); printf("\nEnter String 2 \n"); gets(str2); j=endof(str1); catenate(str1, str2, j); printf("\nThe Concatenated (joined) string is:\n%s",str1); delay(500); break; } case 'b': case 'B': { printf("\nEnter String 1 \n"); gets(str1); printf("\nEnter String 2 \n"); gets(str2); j=endof(str1); catenate(str1, str2, j); j=endof(str1)-1; reverse(str1, j); printf("\nThe concatenated AND reversed string is:\n%s",str1); delay(500); break; } default: { format(10); goto label; } } free(str1); free(str2); } void swap(char *s1, char *s2) { char temp; temp=*s1; *s1=*s2; *s2=temp; } void soundfor(int sec) { for(int i=0;i