Error "was not declared in the scope"

0

This error comes to me in the first line;

  

"Something was not declared in this scope".

I know it's a very basic error, but I'm not realizing what I'm failing and why.

This is my code:

void funcion(Algo x){
    x.b= 1 ;
}

int main(){
    struct Algo{
        int b;
    };
    Algo x;
    funcion(x);
}
    
asked by Facundo San Juan 02.09.2017 в 03:10
source

1 answer

1

Are you looking for something like that?

typedef struct {
int b;
} Algo;
void funcion(Algo x){
x.b= 1 ;
}
int main() {
Algo x;
funcion(x);
}
    
answered by 02.09.2017 / 03:20
source