I have just started to learn C++. I want to call a function inside another function kinda of call back. I wrote this code. But I am getting the
error error: expected primary-expression before ‘int’
return hello(1,2, ta(int y));
^~~
Code:
#include <stdio.h>
#include <iostream>
int thirds(int x){
return x + 1;
}
template <typename T, typename B, typename L>
int hello(T x, B y ,L z ){
int first = x + 1;
int second = y + 1;
int third = z(5);
return first + second + third;
}
int add(){
return hello(1,1, thirds(int y));
}
int main()
{
std::cout<<add();
return 0;
}
My expected output is 10.
Can someone tell me what need to be change? Note: I strictly need all the functions
Aucun commentaire:
Enregistrer un commentaire