Can we return a function in another function ?

Can we return a function in another function ? or All functions are returned only to main ?

for example

int main ()
{
int size1, size2;

function1(size1, size2);
}

double function1 ( x, y)
{
function2(1, 2) <<// IS THIS LEGAL ?
}

double function2 (....)
{
.
.
.
.
}
closed account (Dy7SLyTq)
no thats legal
You can call any function inside another function.
Doesn't he have to write

1
2
3
4
double function1 ( x, y)
{
     return function2(1, 2); 
}


EDIT : Oh I c it is just a draft
Last edited on
@Simula


It was an example to demonstrate the idea of the question. Of course function1 shall return a value. But it is another question.:)
Thanks guys.
@Simula
Yeah i know im just giving an example like vlad said. thanks
Foo. I thought this question was going to be about function pointers or functors, which would have been way cooler.
Topic archived. No new replies allowed.