Struct Initialisation Syntax Help
for(int i=0; i<1440; i++){priceData[i]=-1;};
There's also ZeroMemory and ArrayFill.
There's also ZeroMemory and ArrayFill.
Of course, I'm not thinking right...
I shall give that a test - my actual structures are more complicated still, but fingers crossed ZeroMemory will probably do what I want and I can ArrayFill the rest maybe!
Sorry for being dull - I've used these functions before, it just hadn't occured to me to use them in a constructor...
I'm just getting my head around OOP, but I guess the constructor is just code that runs whenever one of these structs is created and can contain any of these functions and more...
Thanks for the help.
Of course, I'm not thinking right...
I shall give that a test - my actual structures are more complicated still, but fingers crossed ZeroMemory will probably do what I want and I can ArrayFill the rest maybe!
Sorry for being dull - I've used these functions before, it just hadn't occured to me to use them in a constructor...
I'm just getting my head around OOP, but I guess the constructor is just code that runs whenever one of these structs is created and can contain any of these functions and more...
Thanks for the help.
ZeroMemory does a pretty nice job, but it seems to reset some of my enumerated data fields to zero, others oddly to -1... can't tell why yet, but I'm experimenting...
<Experiments demonstrated that I am an idiot - it does reset them all to zero (which if you define them correctly has the correct enumeration!), which is exactly what I need.
I should add that my actual struct constructions are far more complicated than the example I gave above!
I'm still wondering if I might like some more specific way to both initialise and reset a complex structure...
I think I shall write a function to reset everything as I would want it - just like the constructor in the first place.
Which begs the question - is there some way to re-run the constructor code on a struct even after it has been initialised and used etc?
Does a struct definiton somehow work like a class? Can I make the constructor public? How then to call it and point it at the correct already constructed struct?
Maybe easier to just copy paste the 'reset code' into a new function, but I'm trying to learn stuff!
One question - if I call it from the constructor, which could be creating any number of different new variables, how do I reference the 'target variable'?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Maybe a quick question, but I'm struggling to find the answer myself.
I'm trying to initialise all elements of an array within a struct at struct definition, currently using a constructor.
I can't get the right syntax though, or maybe I can't do it this way? - Can someone help?
Thanks - I think I found a pretty good solution myself in the end, but it may be longwinded so any additional thoughts would be great!
New code...
Probably no need to SetAsSeries at this point?