What is the difference between const and constexpr?

Answers were Sorted based on User's Feedback



What is the difference between const and constexpr?..

Answer / nashiinformaticssolutions

• const: Value remains constant; evaluated at runtime.
• constexpr: Evaluated at compile time for optimization.

Is This Answer Correct ?    0 Yes 0 No

What is the difference between const and constexpr?..

Answer / nashiinformaticssolutions

o const: The value is constant and determined at runtime or compile-time.
o constexpr: The value is constant and must be computed at compile-time.

Is This Answer Correct ?    0 Yes 0 No

What is the difference between const and constexpr?..

Answer / glibwaresoftsolutions

• const: Value remains constant; evaluated at runtime.
• constexpr: Evaluated at compile time for optimization.

Is This Answer Correct ?    0 Yes 0 No

What is the difference between const and constexpr?..

Answer / hr@tgksolutions.com

• const: Value remains constant; evaluated at runtime.
• constexpr: Evaluated at compile time for optimization.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is an iterator class in c++?

0 Answers  


Differentiate between a constructor and a destructor in c++.

0 Answers  


What is the difference between delegation and implemented-in-terms-of?

0 Answers  


What is problem with Runtime type identification?

2 Answers  


Can we use pointers in c++?

0 Answers  


i want to know how to copy arrary without using any method or function. I have tried the below using System; class e4 { static void Main(string[] args) { int a,b; int[ ] m= new int[5]; int[ ] n= new int[5]; for(a=0;a<=4;a++) { Console.WriteLine("enter any value"); m[a]=Convert.ToInt32(Console.ReadLine()); m[a]=n[a]; } for(b=0;b<=4;b++) { Console.WriteLine(n[b]); } } } but it will give wrong result can anyone solve this problem

1 Answers   Reliance,


Write a corrected statement in c++ so that the statement will work properly. if (x = y) x = 2*z;

2 Answers  


What is the use of cmath in c++?

0 Answers  


Is eclipse good for c++?

0 Answers  


Can create new c++ operators?

0 Answers  


What is the basic difference between C and C++?

0 Answers   NIIT,


What is "strstream" ?

1 Answers   Huawei,


Categories