It's also worth noting that in C++, int main() can be left without a return value at which point it defaults to returning 0. This is also true with a C99 program. Whether return 0 should be omitted or not is open to debate.
The main function is a special function (in fact it is not even really a function) and so it gets special treatment.
Whether or not you should always have the return statement in main is open to debate - some say you should, some say you shouldn't care. It's entirely based on opinion and since it is so trivial and specialized nobody can tell for sure which is better practice.
Whether or not it is safe to omit the return statement is known - it is safe to leave it out, and it is safe to have it in. There is no debate here.
I did not intend to create such confusion by simply pointing out that for main only, the return statement is optional. Sorry.
#include <iostream.h>
#include<conio.h>
#include <string.h>
int main()
{
char str[100];
int flag;
cout<<"Enter a string\n";
cin>>str;
int x=strlen(str)-1;
for(int i=0;i<=x;i++)
{
if(str[i]==str[x-i])
{
flag=1;
continue;
}
else
{
flag=2;
break;
}
}
if(flag==1)
cout<<"It is a Palindrome\n"<<endl;
else
cout<<"It is not a palindrome"<<endl;
getch();
}