Untitled1

Untitled1 - printf"Enter the string a" gets(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("Enter the string a "); gets(a); printf("Enter the string b "); gets(b); strcat(a," "); strcpy(s,strcat(a,b)); printf("the concatenated string is : %s \n " ,s); reverseCharArray(s, strlen(s)-1); printf("the reversed string is : %s \n :" , s); p return 0; }...
View Full Document

This note was uploaded on 02/14/2011 for the course CS 240 taught by Professor Rego during the Spring '08 term at Purdue.

Ask a homework question - tutors are online