Hey, sorry if this question seems basic however I am relatively new to C++ and have done some searching around but to no avail. I then came across this community and thought I would try it out :)
Basically, using Visual C++ 2008, I have a custom data structure, lets call it "MyStructure".
struct MyStructure {
float x, y, z;
};
I am then creating an array of type 'MyStructure' later on in my code:
MyStructure myArray[100];
Now I know I can modify the array elements using the following syntax...
myArray[0].x = 12.0f;
myArray[0].y = 13.0f;
myArray[0].z = 15.0f;
myArray[1].x = 15.0f;
myArray[1].y = 13.0f;
myArray[1].z = 22.0f;
myArray[2].x = 10.0f;
myArray[2].y = 32.0f;
...
etc
... however some of these arrays are quite large which renders this method massively time consuming.
Is there a fast way of inputting values into each array element?
I tried the following syntax, however it seems to be quite temperamental:
MyScructure myArray = {{12.0f,13.0f,15.0f},{15.0f,13.0f,22.0f},{10.0f,32.0f,44.0f}};
...
later in my code when i need to modify the array
...
myArray = {{132.0f,134.0f,152.0f},{151.0f,133.0f,242.0f},{105.0f,372.0f,944.0f}};
Thanks in advance for any replies.