I was reading the section of the tutorial on structures, and man I'm so lost. Maybe it's because I'm trying to compare structures in C++ to modules in QBasic.
In Qbasic, a module initialized like so:
See, to me, I see a structure in C++ as a module... I don't understand it in any other way. In the tutorial, it gives this example:Code:: Gosub Module1 : : Module1: : PRINT "This is a module" : RETURN
I was thinking for a while that structures were a sort of "bucket" for a certain specified number of variables. But then, in the last line, where it says "an_example.x=33" why is it doing that? I figure all you would have to do is example.x=33 to set the variable "X" in structure "Example" to a value! Why do they go through the trouble to change the name of example to "an_example" and then change the value of X? It's all so confusing, I'm losing my brain through my ears! Someone help! Thanks!Code:struct example { int x; }; example an_example; //Treating it like a normal variable type an_example.x=33; //How to access it