ENع
الدرس 23 · Modern C++

const and constexpr

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

A C++ program lives twice: once while the compiler builds it, and again every time it runs. constexpr asks the compiler to work a value out while it builds, so it is baked into the program and can size an array. const only promises that a value never changes after it is set, and that value may come from run time. Follow a ten-line program as sq(4) is computed by the compiler, argc arrives when the program runs, and two small mistakes stop the build.

12 دقيقة11 خطوات5 أسئلةBeginner
شكل 23 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.