functions

Can we write and call a function inside another function ,,,please explain this with an example ?? if multiple funcs ..how ?? what should be their return types ..??
Write a function inside another? no.

Call a function from inside another? yes.

1
2
3
4
5
6
int function_two(){
return 2;
}
int function_one(){
return function_two();
} // returns 2 



thanx ultifinitus ...
but, can we pass a function out put to another func..
eg.: func1(int func2, double func3)
{
\\ use func3 and func 2 return value here ...
}

is this possible ?? if yes ..please give some concrete example ...??
Yes, it most certainly is, now do you want parameters with those parameters, or do you just want the function?
can u explain ..both if possible ..please


1
2
3
4
5
int func1 (int a, int b)
{
a = func2(); //dunno what you want the functions to return, but whateva.
b = func3();
}


Err, or maybe this wasn't at all what you were asking for... I'm tired.
Last edited on
thanx angelhoof ..
but i was looking for something like this :

int func1 (int func2(void), int func3(void) )
{
}

or is this same as what u had written ..
i donot know that ...
It's called a function pointer. Google is your friend. You can look at functors if you want more.
Topic archived. No new replies allowed.