c / opengl question

C / opengl question:

Can i do this?




    typedef struct 
    {
      int i;
    }widget;

    display(void){
       widget newWidget2;
       newWidget2.i = 5;

       newWidget1 = newWidget2; // Can i update widget1.i using this line?
    }

    void main(){
       widget newWidget1;
    ...
       glutDisplayFunc(display); 
    ...

    }

thanks!

Sorry but this is pure plain simple C, and it is not related to OpenGL in any way.

You newWidget1 should be declared global if you want to access it from multiple functions without passing it in parameters.

widget newWidget1;

display(void){

newWidget1 = newWidget2;
}

void main(){

glutDisplayFunc(display);

}