code is not working :(
#include<iostream.h>
#include<process.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
void palindrome(char *str1,int l);
why so many libraries ? you only need iostream
anyway i should tell you that I dont reccomend using goto ,their purpose can be done with structured programming, pointers must be initialized, I dont get what you've tried to do with that double for's, you basically take every element from the string and compare it with ALL the other elements in the string...here is a efficient version i coded
#include<iostream>
usingnamespace std;
bool palindrome(char *str1, int l); // using bool function that return true and false
void main()
{
int l;
char string[20];
cout << "Enter 1st string \n";
gets(string);
char *str1 = &string[0]; // pointers must be initialized
l = strlen(str1);
cout << "Length " << l;
if (palindrome(str1, l) == true)
cout << "\nIt is palindrome";
else
cout << "\nIt is not palindrome";
cin.get(); // get some input so the console won't close
}
bool palindrome(char *str1, int l)
{
int a = 0;
int b = l - 1;
while (a < b)
{
if (str1[a] != str1[b])
returnfalse;
a++;
b--;
}
returntrue;
}