So, i'm having a bracket issue in line 83:9 or where the slashes are. it's telling me " error: expected identifier or '(' before '{' token", I don't understand how i am receiving this error. If somebody can explain to me how I'm receiving it, thank you.

   _Bool palindromes(char string[])
    {
    int i = 0;
    while(string[i]=0 != '\0')
            {
            i++;
            int last_place = i - 1;
                    for(int n=0; n<=last_place; n++)
                            {
                    if(string[n] == string[last_place])
                    {
                    last_place--;
                    continue;
                    }

                    if(n !=last_place)
                    {
                    return false;
                    }

                            }
            }

      }

    { //here is the issue
    while(string[i]=0 != '\0')
    int i=0;
            {
            i++;
            int last_place = i - 1;
                    for(int n=0; n<=last_place; n++)
                    {
                    if(string[n] == string[last_place])
                            {
                    return true;
                            }
                    }
            }
       }

Recommended Answers

All 2 Replies

Try re-indenting your code with a consistent formatting of your brace brackets. For example, in some cases your { is placed at (almost) the same level following a statement as in

_Bool palindromes(char string[])
 {

and then you do

if(string[n] == string[last_place])
        {
return true;
        }

You also do

while(string[i]=0 != '\0')
int i=0;
        {
        i++;

which makes no sense. If you apply a consistent style and make your indentation actually match your control structures your problem will become more obvious.

While it's poorly formatted (F rated), line 26 as presented doesn't make sense to me why there is a brace there. That is, you have your _Bool palindromes and it's left brace on line 2 and on line 24 it's closing right brace then you have an opening brace without a reason why. No new function or such so ... explain why you did that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.