Skip to content

Instantly share code, notes, and snippets.

@kjk
Last active May 31, 2020 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjk/c5bbe7f6683fc0b215d7c3bf19ddf4d2 to your computer and use it in GitHub Desktop.
Save kjk/c5bbe7f6683fc0b215d7c3bf19ddf4d2 to your computer and use it in GitHub Desktop.
#include <iostream>
constexpr long long factorial(long long n)
{
if (n == 0)
return 1;
else
return n * factorial(n - 1);
}
int main()
{
char test[factorial(3)];
std::cout << factorial(7) << '\n';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment