Untitled1

Untitled1 - printf("Enter the string a...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include <stdio.h> #include <stdlib.h> #include <string.h> # char* reverseCharArray(char s[], int pos) { int r = (strlen(s)-1) - pos; i if (r < pos) { char temp = s[r]; s[r] = s[pos]; s[pos] = temp; return reverseCharArray(s, --pos); } else { return s; } } int main () { char s1[100]; char a[50] ; char b[50] ; char s[100];char c[100];
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: printf(&quot;Enter the string a &quot;); gets(a); printf(&quot;Enter the string b &quot;); gets(b); strcat(a,&quot; &quot;); strcpy(s,strcat(a,b)); printf(&quot;the concatenated string is : %s \n &quot; ,s); reverseCharArray(s, strlen(s)-1); printf(&quot;the reversed string is : %s \n :&quot; , s); p return 0; }...
View Full Document

Ask a homework question - tutors are online