1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
int add(int a, int b) {
return a + b;
}
int main() {
int x = 10;
int y = 20;
decltype(add(x, y)) result; // result is of type int
result = add(x, y);
std::cout << "result: " << result << std::endl;
return 0;
}
Back to decltype