Posts

Showing posts with the label Storage Duration

Scope and Lifetime of Variables in C++ | C++ में वेरिएबल्स का स्कोप और लाइफटाइम

In C++, Scope and Lifetime are two important concepts related to variables. Scope determines where a variable can be accessed in a program, whereas lifetime determines how long a variable exists in memory during program execution. C++ में Scope (स्कोप) और Lifetime (लाइफटाइम) वेरिएबल्स से संबंधित दो महत्वपूर्ण अवधारणाएँ हैं। Scope यह निर्धारित करता है कि प्रोग्राम में किसी वेरिएबल को कहाँ एक्सेस किया जा सकता है, जबकि Lifetime यह निर्धारित करता है कि प्रोग्राम के चलने के दौरान कोई वेरिएबल कितने समय तक मेमोरी में मौजूद रहता है। 1. What is Scope in C++? | C++ में Scope क्या है? The scope of a variable is the region of a program where that variable can be accessed or referred to by its name. A variable can be accessed only within its scope, subject to access-control and name-lookup rules. किसी वेरिएबल का Scope प्रोग्राम का वह क्षेत्र होता है जहाँ उस वेरिएबल को उसके नाम से एक्सेस किया जा सकता है। किसी वेरिएबल को उसके Scope के अंदर ही एक्सेस किया जा सकता है, जो कि C++ के एक्सेस-कंट्रोल ...