I am having a pretty basic C++ problem, and I really dont get why I have that Problem... So thats my function:
void build(int *&v) {
v = new int[m];
for (int i =0; i<m;){
v[i]=i++;
}
for (int i=0;i<m;i++){
cout <<i << " " << v[i] <<endl;
}
I would expect to get an output like
0 0
1 1
2 2
since i is always incrementet after processing. So i is =0 first -> 0 0 then its incrementet to 1, which leads to 1 1 and then its incrementet to 2 which leads to 2 2
But my console always gives me
0 0
1 0
2 1
Where is my fault?