#include // A constexpr function to calculate the product of two integers constexpr int product(int x, int y) { return x * y; } int main() { // Calling product with constant arguments, allowing compile-time evaluation constexpr int compileTimeResult = product(5, 7); cout << "Compile-time result: " << compileTimeResult << endl; // Output: 35 // Using the constexpr function to define the size of a C-style array int arr[product(2, 3)]; // Size of arr is 6, determined at compile time // Initialize and print elements of the array for (int i = 0; i < product(2, 3); ++i) { arr[i] = i + 1; cout << arr[i] << " "; } cout << endl; // Output: 1 2 3 4 5 6 // Calling product with a runtime argument, forcing runtime evaluation int a = 10; int runtimeResult = product(a, 4); // Evaluated at runtime cout << "Runtime result: " << runtimeResult << endl; // Output: 40 return 0; }