Created a palindrome but it is supposed to ignore the whitespaces in the string. can anyone tell me what's wrong here?
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
main(){
char mes1[80],mes2[80];
printf("Enter a string here --> ");
/* scanf("%s",mes1); */
getline(mes1);
strcpy(mes2,mes1);
reversi(mes1,mes2);
printf("%s %s\n",mes1,mes2);
if (strcmp(mes1,mes2) == 0)
printf(" You entered a palindrome word \n");
else
printf(" No, the word is NOT a palindrome \n");
}
getline(m1in)
char m1in[80];
{
int i=0;
char c;
while(i<81 && (c=getchar()) !='\n'){
m1in[i]=c;
++i;
}
m1in[i]='\0';
return;
}
reversi(m1,m2)
char m1[80],m2[80];
{
int i=0,jl;
jl=strlen(m1);
while (i<jl){
m2[i]=m1[jl-i-1];
i++;
}
return;
}