Function Execution and Variable Initialization

Explore the difference between the 'const', 'constexpr', 'consteval' and 'constinit' keywords.

We'll cover the following

Now it’s time to write about the differences between const, constexpr, consteval, and constinit. First, I discuss function execution and then variable initialization.

Function execution

The following program has three versions of a square function.

Get hands-on with 1200+ tech skills courses.