i know how to find palindrome and also how to find reverse of string using for loop. but i wish to do it within a loop (for) using flag. can u please tell me how to use flag in c . my code is as follows
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int i,j; int d; int d1;int flag=0;
char str[10];
char str2[10];
char str3[10];
clrscr();
printf("enter a string");
scanf("%s",str);
strcpy(str2,(strrev(str)));
for(i=0;i<=d-1;i++)
{
if(str2[i]==str[i])
flag=1;
}
if(flag==1)
printf("palindrome");
else
printf("not palindrome");
getch();
}
thank you in advance