i mean what is testa? a pointer of type nodo? can a declaration be done like that??? notcice the ampersand sign infront of testa? that is making sooo confused but the main code is working fine..soo am the ignorant one here...pls dont tell me to go and read on pointers been doing that for sometime now...some one pls just explain... Nodo * testa; is fine..declaring a pointer called testa of type testa..but Nodo * &testa, in the parameter of the function inserimento...is making me go nuts...help pls...
The argument is passed by reference, that means that you want to change the pointer in order to change what it points to.
By instance in your code you may have testa = new Nodo(numero);
It's a reference to a pointer to a "Nodo". And yes, it's a perfectly valid declaration. Such a declaration is used when the function needs to directly modify the pointer that was passed to function. In addition, a reference to a pointer prevents the calling function from passing the address of a variable/object when it expects and actual pointer. In C, the equivalent declaration was a pointer to a pointer.