yeah that makes sense, now im having trouble with the coding....
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char str1[81];
char str2[81];
int i1, i2;
printf("Enter a string: ");
fgets(str1, sizeof (str1), stdin);
for(i1 = 0; str1[i1] != '\0'; i1++);
i1--;
for(i2 = 0; i1 >= 0; i1--, i2++)
str2[i2] = str1[i1];
str2[i2] = '\0';
printf("%s %s\n", str1, str2);
if (str1 == str2) /*originally had if (strcmp (str1, str2) == 0)*/
printf("Pallindrome\n");
else printf("Not Pallindrome\n");
system("PAUSE");
return 0;
}
The damn thing aint working, it doesnt return the correct result with either if loop.