#include<stdio.h>
#include<iostream>
void sum(int, int, int *p);
int main()
{
int x;
int y;
int accum;
int *p;
p = &accum;
x=5;
y=4;
accum =5;
sum(x, y, p);
printf("%d\n", accum);
return 0;
}
void sum(int x, int y, int*p)
{
if(x<y)
*p+=x;
else
*p+=y;
}
Basic user input. If that's not what you want, clarify the question.
By the way, you could pass sum(x,y,&accum);
and it would still work. Or you could do it the easy way and change the argument p to reference.