Linked Questions

Popular Questions

compile error: expected expression before ‘{’ token

Asked by At

I am getting the error

error: expected expression before ‘{’ token

when trying to compile the following code:

#include <stdio.h>

int main()
{
    srand (time(NULL));
    int Seat[10] = {0,0,0,0,0,0,0,0,0,0};
    int x = rand()%5;
    int y = rand()%10;

    int i, j;
    do {
        printf("What class would you like to sit in, first (1) or economy (2)?");
        scanf("%d", &j);
        if(j == 1){
            Seat[x] = 1;
            printf("your seat number is %d and it is type %d\n", x, j);
        }
        else{
            Seat[y] = 1;
            printf("your seat number is %d and is is type %d\n", y, j);
        }
    }while(Seat[10] != {1,1,1,1,1,1,1,1,1,1});
}

Background: The program is designed to be an airline seat reservation system.

Related Questions