Sunday, November 28, 2010

A) Write a program to accept the string and display the reverse of that string using pointers(without using strrev() function)? B) Write a progra

#include

#include

char StringReverse(char *str)

{

int length = strlen(str);

int Found = 1;

while( length-- > 0)

{

printf("%c",str[length]);

if( (str[length] != str[strlen(str) -1 - length] ) && Found == 1 )

Found = 0;

}

if (Found) printf(" ) Is Palindrome String\n");

else printf(" )Is Not Palindrome String\n");

}



main()

{

char *str;

str = (char *)malloc(20);// Dynamic Memory Allocation

printf("Please Enter the String\n");

scanf("%s",str);

printf("Reverse of ( %s = ",str);

StringReverse(str);



}