Skip to main content

C++ Variable( आओ जाने वेरिएबल्स के बारे में)

हेलो Students...(अगर आप Program  को रन कैसे करते है तो  इस Link पर click करे )

learn c++ programming in 21 days for beginners,learn c++ codecademy,,c++ tutorial for beginners,c++ programming examples,learn c++ the hard way,learn c++ reddi,tbest way to learn c++,c++ online course free.

आज मैं आपको कुछ C++ के variables  के बारे में बताने जा रहा हूँ सबसे पहले हमारे दिमाग में ये सवाल आता है कि वेरिएबल्स क्या होते और इनका programming  क्या use होता है | 


C++ Variable

A variable is a name of memory location(ये एक मेमोरी लोकेशन है ). It is used to store data(ये डाटा को स्टोर करने के लिये इस्तेमाल होता है ). Its value can be changed and it can be reused many times.(ये वेरिएबल्स को एक बार store करने पर आप इसे बार बार use कर सकते है )

It is a way to represent memory location through symbol so that it can be easily identified.


Let's see the syntax to declare a variable:

type variable_list;(टाइप वेरिएबल लिस्ट )    
ये एक सिंटेक्स है की हम वेरिएबल्स को कैसे लिख सकते है जैसे आप देखे। .... 


  1. int x;       (यहाँ पर int एक डाटा टाइप है और x एक वेरिएबल है )
  2. float y;    (यहाँ पर float एक डाटा टाइप है और y एक वेरिएबल है )
  3. char z;     (यहाँ पर char एक डाटा टाइप है और z एक वेरिएबल है )



We can also provide values while declaring the variables as given below:

  1. int x=5,b=10;  //declaring 2 variable of integer type    
  2. float f=30.8;    
  3. char c='A';    


Rules for defining variables

A variable can have alphabets, digits and underscore.

A variable name can start with alphabet and underscore only. It can't start with digit.

No white space is allowed within variable name.

A variable name must not be any reserved word or keyword e.g. char, float etc.

Valid variable names:

  1. int a;    
  2. int _ab;    
  3. int a30;    

Invalid variable names:


  1. int 4;    
  2. int x y;    
  3. int double


Comments

Popular posts from this blog

Memory Hierarchy

Memory Hierarchy A memory unit is an essential component in any digital computer since it is needed for storing programs and data. Typically, a memory unit can be classified into two categories: The memory unit that establishes direct communication with the CPU is called  Main Memory . The main memory is often referred to as RAM (Random Access Memory). The memory units that provide backup storage are called  Auxiliary Memory . For instance, magnetic disks and magnetic tapes are the most commonly used auxiliary memories. Apart from the basic classifications of a memory unit, the memory hierarchy consists all of the storage devices available in a computer system ranging from the slow but high-capacity auxiliary memory to relatively faster main memory. The following image illustrates the components in a typical memory hierarchy. Auxiliary Memory Auxiliary memory is known as the lowest-cost, highest-capacity and slowest-access storage in a computer system. Auxiliar