typedef struct _foo { int bar; void foo(int i) bar = i; } foo; foo var1(1), var2(2), var3(3); vector<foo*> vec; vec.pushback(var1); vec.pushback(var2); vec.pushback(var3);
void foobar(vector<foo*> vec) { foo* aux; for (int i=0;vec.size(), ++i) { aux = vec[i]; *(aux).bar = 1; //that's where I don't know the sintax, and I can't find it //anywhere. You probably understand what I mean with this pseudo //sintax, I just want to alter the value in my struct, so to say, //alter the value in the memory location of the object. } }
(*aux).bar = 1
aux->bar = 1;
vec.pushback(var1); vec.pushback(var2); vec.pushback(var3);
vec.pushback(&var1); vec.pushback(&var2); vec.pushback(&var3);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)