0

I have seen similar questions asked, and all seem be to be someone has forgotten to close their brackets or something similar. I have checked my code many times for that and tried experimenting adding brackets or moving them around to find out where it was going wrong.

I am getting the "expected identifier or ')' error for the bracket at line 6. However when I click on this bracket, the bracket at line 35 is also highlighted indicating that they are linked. So I am not sure where I am going wrong. Please help!

#include <stdio.h>
#include <cs50.h>

int main(void);

{
int spaces;
int hashes;
int row;
int h; 


    do
    {
     int h = get_int();


     printf("Height: %i\n", h);


     for (int rows = 1; rows < h; rows++);
            {
                for (spaces = (h - 1); spaces >= 0; spaces--)
                    {
                    printf(" ");
                    }
                for (hashes = (rows + 1); hashes <= (rows + 1); hashes++ )
                    {
                    printf("#");
                    }
                    printf("\n");
            }
    }
    while (int h >= 0 && h < 23; h++);
}

1 Answer 1

1
int main(void);

You must eliminate the semicolon (;) that is the whole problem with your error

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .