Question: Consider the following (simplified) example where two lambda functions call each other, one of which also takes another function as an argument. I need to use lambda functions, since the functions also pass modified, nested functions between each other. 

```
#include <iostream>
using namespace std;

auto f = [](int n, auto h)
{
    if(n >= 5) return n;
    cout << "h is some function " << h(4.0) << end; 
    auto func = [](int m){ return m*h(m); }; // some nested function   
    return g(n+1,func);  
};

auto g = [](int n, auto h)
{
    if(n >= 5) return n;
    cout << "h is some function " << h(5.0) << end; 
    auto func = [](int m){ return m*h(m); }; // some nested function   
    return f(n+1,func); 
};

int main()
{
    auto initial_function = [](int m){ return m*m; };
    f(1, initial_function);
    return 0.0;
}

```

This returns the usual error *undeclared identifier 'g'* which was to expect since there is no header file. So my question is: What is the proper syntax to declare the two lambda functions?

Answer: 
You need to capture the lambda inside `g` (or vice versa). `g` and `f` are variables which are **pointing** to a (unnamed) function. Making these lambdas doesn't make sense. Lambdas work best when you need a function in local scope. You will have to convert at-least one of them as a function and do a forward-declare for it to get this code working

```
int f(int n);
auto g = [](int n)
{
     if(n >= 5) return n;
    return f(n+1); 
};

int f(int n)
{
    if(n >= 5) return n;
    return g(n+1);  
}

int main()
{
    f(1);
    return 0.0;
}

```

Based on OP's edit, probably what the OP needs is

```
template<typename T1, typename T2>
auto g(int n, const T1& f, const T2& h)
{ 
    if(n >= 5) return n;
    cout << "h is some function " << h(5.0) << end; 
    return f(n+1); 
} 

```

To be called as:

```
auto h = [](int m) { return m*m; };
auto f = [h](int m) { return n >= 5 ? n : return g(n+1, f, h); };
g(n, f, h);

```
The type of a lambda is not well defined, so there isn't a straightfoward answer. I prefer @bashrc's answer, but if you insist on having two lambdas, this variation might do the job:

```
extern int (*f)(int n);

auto g = [](int n)
{
    if (n >= 5) return n;
    return f(n + 1);
};

int (*f)(int n) = [](int n)
{
    if (n >= 5) return n;
    return g(n + 1);
};

int main()
{
    f(1);
    return 0;
}

```