Passing expressions through functions

Is there a way to pass an expression through a function. For example:

1
2
3
4
5
6
7
8
9
 
int function(int a1,int a2,int a3,int a4)
{
int out=a1*a2+a3-a4*a1*a3;
return out;
}
 
int num=6;
printf("%i",function(num/2,num*num,num,-num));


I expected this to work. Any help would be appreciated. Thanks!
This is not worth a topic for discussion, sir. You certainly haven't tried something out and you want help with it? How? Who said it is or isn't working?
I am a beginer with c++ and this is my first time to this forum. I'm sorry if my question isn't applicable. What I meant to say was that It's not working for me. I got the error message; " Function "function" is not defined in the current scope (tmpfile):1". After I rebooted, the problem fixed itself, so I assume it must have been a bug. I apologize!
Topic archived. No new replies allowed.