ok first attempt to built with pointers
Code:
void built(vector<int>* x);
int main()
{
vector<int> v;
built(&v);
return 0;
}
void built(vector<int>* x)
{
*x.push_back(3);
*x.push_back(4);
return ;
}
Compiling C:\Documents and Settings\mixalis\Επιφάνεια εργασίας\C++ applications\passing by pointer.cpp...
[Error] C: request for member `push_back' in `x', which is of non-aggregate type `vector<int,allocator<int> > *'
[Error] C:\: request for member `push_back' in `x', which is of non-aggregate type `vector<int,allocator<int> > *'
the main idea is :
Code:
void foo(int* n)
{
*n = 0;
}
void foo(int& n)
{
n = 0;
}
int main()
{
int n;
foo(&n);
return 0;
}
right???
give some feedback. I swear I will study from the book and not continue misusing my time, jumping from example to example on the Internet ))))