What is wrong in this code?
#include <stdio.h>
bool func(char *, int);
void main()
{
char *a = "Interview";
if(func(a, 9))
{
printf("True");
}
else
{
printf("False");
}
}
bool func(char *s, int len)
{
if(len < 2)
return true;
else
return s[0] == s[len-1] && func(&s[1], len-2);
}
I believe this function always returns TRUE. This is an interview question. But, when I try to compile this, it shows six errors...
#include <stdbool.h>. The return type ofmainshall beint.