简体   繁体   中英

syntax error missing ';' before 'type'

I have this error:

error C2143 syntax error : missing ';' before 'type'

Coming from this block of code:

int GetValidatedInteger(int Min, int Max);

int main (void)
{
    // Student number //
    int GetstudentID();

    int studentID=0;
    {
        int studentID;
        printf("Plase enter a student  Number <101-999>" );
        scanf("%d", &studentID);
        return studentID;
        fflush(stdin);

        return (studentID);
    }

I have no idea what it means. Could someone explain this to me?

I think this is what you are trying to do.. And it should be outside of main function.

int GetstudentID()
{
    int studentID;
    printf("Plase enter a student  Number <101-999>" );
    scanf("%d", &studentID);
    return studentID;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM