1
I wanted to know why you are causing the error:
Error converting int to int*'
This program is only for training the use of pointers in parameters.
void teste(int *t){
*t = 50;
}
int main(){
int x = 10;
cout << "Sem usar o metodo com ponteiro: " << x << endl;
teste(x);
cout << "Usando o metodo com ponteiro: " << x << endl;
return 0;
}
What you got from setting pointers?
– Woss
Well the pointer is a variable that stores the address of another, I can manipulate whatever variable in which part of my code wants, this is the idea I learned about pointers
– Renan Ustolin
But you need to declare this pointer in your code and define which variable it will handle.
– Woss
Ah then can only use a pointer parameter, being a pointer? I pass the address of the virile X to a pointer, and use the pointer in the function?
– Renan Ustolin
@Renanustolin The answer solved your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful for you. You can also vote on any question or answer you find useful on the entire site (when you have 15 points).
– Maniero