ext-cryptopp/TestPrograms/test_cxx11_constexpr.cpp

11 lines
148 B
C++

constexpr int fact(int n)
{
return n <= 1 ? 1 : (n * fact(n - 1));
}
int main(int argc, char* argv[])
{
fact(4);
return 0;
}