help with pionters as function parameters.

Hi guys. I want to know how and why should I use pointers or references as fuction parameters.
I need examples please :)
1
2
3
4
5
6
7
8
9
10
void fn(int* pnArg)
{
 *pnArg = 10;
}
void parent(void)
{
 int n = 0;
 fn(&n); // this passes the address of n
 // now the value of n is 10
}
Last edited on
Thank you jacobhaha :)
Topic archived. No new replies allowed.