I have a custom structure called pair, which has two arguments: int winner, and int loser
typedef struct
{
int winner;
int loser;
}
pair;
I also have an array of pairs called pairs, but when I attempt to add a pair to the array, it says,
tideman.c:157:37: error: expected expression
pairs[pair_count] = {i, j};
Is there a problem with using curly bracket notation for adding structures to arrays in C? If I make a variable for adding pairs, will it change all the pairs in the array every time I add a new pair (due to mutability problems)?
for (int i = 0; i < candidate_count; i++)
{
for (int j = 0; j < candidate_count; i++)
{
if (preferences[i][j] > preferences[j][i])
{
pairs[pair_count] = {i, j};
}
}
}