What is the usage of constexpr?

Why didn’t we write like (int wordnumber= 5;) and put constexpr in the front. (constexpr int wordnumber=5;)

1 Like

Hello @Tolga_Cetinus,

because a “constexpr” variable will be evaluated at compile time.

Kind regards
Kevin

1 Like

Thanks.

1 Like

You’re welcome.

Don’t forget to mark a solution so the thread will be closed automatically if you are fine.

Privacy & Terms