Message from C, C++ discussions

December 2019

— Asking me?

— 

Int main()
{ int n=10;
*number=n;
Function(*number);
}

And function definition-
void Function(int *x)
{
*x=5;
}

will this code change value of n to 5?

— Why don't you try?

— Its showing error

— No known conversion from 'int' to 'int *' for 1st argument;

— Try to use references &. Google, how to work.

— Wrong

— Whats wrong?

— Int main()
{ int n=10;
Function(&n);
}

void Function(int *x)
{
*x=5;
}

— +1

— Okay thanks

— Int main()
{ int n=10;
int* number=&n;
Function(number);
}

void Function(int *x)
{
*x=5;
}