Cristiano Lacerda
Cristiano Lacerda

Reputation: 1

expected ')' error in Xcode when giving an address to function

There is a little arrow under the "&" and if I remove it, it works. Im new to Xcode and i'm pretty sure this would compile on my old PC. I had previous declared in the code booth the struct and the variable barra.

void InitBarra(struct Barra &barra)
{
    barra.x = WIDTH/2;
    barra.y = HEIGHT;
    barra.vidas = 3;
    barra.velocidade = 7;
    barra.placar = 0;
}

Upvotes: 0

Views: 66

Answers (1)

Michael Dautermann
Michael Dautermann

Reputation: 89509

This really should be a pointer:

void InitBarra(Barra *barra)
{
    barra->x = WIDTH/2;
    barra->y = HEIGHT;
    barra->vidas = 3;
    barra->velocidade = 7;
    barra->placar = 0;
}

Where the Barra struct is declared and/or malloc'd from the calling function.

Upvotes: 3

Related Questions