can anyone help me make my program work. after it capitalize i want it to reverse the new string. something like palindrome.
#include<stdio.h>
#include<ctype.h>
#include<string.h>
/*program begins here*/
int main()
{
/**/
char string[100];
char *ptr = string;
/*shws the user what to do*/
printf("Enter string and use a space after a fullstop\n");
/*gets the string that was entered*/
gets(string);
/* looks at the first letter of string */
*ptr = toupper(*ptr);
/* going through the string entered*/
while(*ptr)
{
if( isspace(*ptr) )
{
*(++ptr) = toupper(*ptr);
}
++ptr;
}
/*shows user the new string*/
printf("your new string is %s\n",string);
}
// Reverse string function
int ReverseString(char *str)
{
int x = strlen(str); //takes length of string
for(int y = x; y >= (x/2)+1; y--) //for loop arranging the string
{
swap(str[x-y],str[y-1]); // swaps letters
}
return 0; //return
}