Hey all
so yes basically the subject title gives it away really. Im just creating a
multidimensional array made up of my own particle structure using visual studio
c++ 2008
Particle myParticles[ROWS][COLS];
i then continue to fill in all the info i need to this array
but how do i return it back to my main code without causing errors and memory
leaks
i was trying
Particle[][] CreateFlag(int size,Vector3 InitialPos){
//fill array
return &myParticles[0][0];
}
then in my main code
Flag[0][0] = CreateFlag(size,Pos);
this is all wrong im sure but thats why im here.. i was also wondering if i
passed a pointer to a multidimensional array from my main code and just filled
that in within the function. or is that just bad programming?
eg
particle myparticle[10][10];
createflag(myparticle);
void createflag(particle flag[10][10]){
particle testflag[10][10] ;
//fill testflag
memcpy(flag,testflag, sizeof testflag);
}
any help and guidance would be much appreciated
g