JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

हिंदी माध्यम नोट्स

Categories: c++ language in hindi

C++ : Variable Basic & Integer Type , what is Variable Basic & Integer Type in c++ language in hindi

what is Variable Basic & Integer Type in c++ language in hindi , C++ : Variable Basic & Integer Type :-
C++ एक object-oriented programming language है | अतः इसमें प्रोग्रामर खुद की variable को बनाया जा सकता है |लेकिन प्रोग्रामर को variable declamation मे सतर्क रहना चाहिए | यूजर define variable को बनाने से पहले , प्रोग्रामर को इसके standard को समजना चाहिए जिससे की वो एक efficient variable बना सके |
C ++ मे दो प्रकार के variable type होते है :-
1.Fundamental Type
2.Compound Type
इस article मे , variable के basic और Fundamental Type मे से integer type को discuss करेगे |
Variable Basic
किसी programming language मे , किसी इनफार्मेशन को store करने के लिए memory मे space की जरूरत होती है |अतः किसी item/element की इनफार्मेशन को store करने के लिए ,प्रोग्राम को तीन fundamental properties को ध्यान मे रखना होता है |
-information कहा store होगी ?
-किस तरह की value store होगी ?
-value क्या होगी ?
इसे एक उदाहरण से समजा जा सकता है :
#include<iostream.h>
#include<conio.h>
void main()
{
using name space std;
int a ;
cout<<“Enter value”<<endl;
cin>>a;
char p;
p=g;
cout<< “Charecter”<<p<<“has a value”<<a<<endl;
getch();
}
इस उदहारण मे दो variable को declare किया गया है |
1.int a : ये एक integer type variable है जो की यूजर द्वारा input की गयी value को hold करता है |इसमें int : type of information , a : space for information है |
2.char p : ये एक character  type variable है जो की alphabet  ‘g’  को hold करता है |इसमें char : type of information , p : space for information  और  alphabet ‘g’ : value of information  है |
Naming of Variable
जब किसी variable को declare किया जाता है c++ मे कुछ standard होते है जिसे प्रोग्रामर को फॉलो करना होता है |ये standard निन्म है :-
1.variable name मे केवल character , digits और अंडरस्कोर ( _ ) को use कर सकते है |
2.Upper case को lower case character से अलग consider किया जाता है |
3.variable name का पहला character , कभी भी डिजिट नहीं हो सकता है |
4.c++ keyword को variable name नहीं हो सकता है |
5.C++ मे variable name की length की कोई limit नहीं होती है |
6.अगर variable name मे , पहले एक या  दो underscore और उसके बाद upper score character , C++ Compiler द्वारा एसे variable को implementation मे reverse किया जाता है |
कभी कभी कुछ variable name complier error नहीं देते है लेकिन misbehave जरुर करते है |इसका मतलब है की variable name मे कोई error नहीं है लेकिन इन variable को implementation के लिए reverse किया गया है |इसका उदाहरण है :
_time_stop और _dunut आदि |
नीचे कुछ variable name की लिस्ट है :
variable
status
int
marks ;
valid
int
marks ;
valid
and different from marks
int
marks ;
valid
and different from marks and marks
int age;
invalid
: due to int
int my_age;
Valid
int _myage;
Valid
but reverse
int 4age;
Invalid
: Due to start with digit
int char;
Invalid
: Due to Keyword ‘char’
int begin;
Invalid
: Due to Pascal Keyword ‘begin’
int my_first_variable;
valid
int My-variable;
Invalid
जब किसी variable name दो या दो से अधिक words को use किया जाता है तब इन words को underscore से differentiate करते है | या सभी words के पहले alphabet को capital मे लिखा जा सकता है |
जैसे :
int my_first_variable;     या  int MyFirstVariable ;
Reading a variable in real world
किसी variable और function के naming हमेशा ही बर्निंग topic होता है क्योकि प्रत्येक प्रोग्रामर के अलग standards होते है | real programming world मे , variable name से पहले ,प्रोग्रामर कुछ character insert जरुर करते है जो की variable से related information को define करते है |उद्धरण के लिए :
integer age को nage से भी named किया जा सकता है जिसमे character ‘n’ age के integer type को define करता है |जिससे किसी प्रोग्रामर को इस variable को identify करना सरल हो जाता है | इसके अलावा कई सारे prefix को use किया जाता है : जैसे :-
1. str और sz : इसका use , null string को represent करने के लिए किया जाता है |
2. b: इसका use, Boolean value के लिए जाता है |
3. p:इसका use, pointer के लिए जाता है |
4. c:इसका use , single character के लिए किया जाता है |
Integer Type
Integer एसे number होते है जिसमे कोई fractional नहीं होता है |उदाहरण के लिए 3,100,-45 और 0 आदि |integer की सख्या असख्य होती है |इसलिए memory मे सभी integer number को represent करने के लिए enough space नहीं होता है |अतः सभी programming language , integer के एक range को define कर सकता है |C++ कई सारे option देता है जिससे integer type को manage किया जा सकता है |
1.c++ integer range मे से कोई भी integer को choose करने के facility देता है |
2.c++ खुद के object को declare करता है |
सभी integer type अलग अलग size की memory को allocate करता है |अतः जब memory space बहुत बड़ा होता है तब ये integer type की बहुत बड़ी range को कवर करता है |integer दोनों positive और negative value को hold कर सकता है |
width of integer का मतलब है integer द्वारा memory मे occupy space |अतः integer के width को निन्म keyword से modify किया जा सकता है :
1.short : width को reduce किया जाता है |
2.long : width को बढाया जाता है |
3.int : width normal होती है |
इसका उदहार है :
#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std ;
int a,b,sum;
cout<<“Your First Number : “<<endl;
cin>>a;
cout<<“Your Second Number : “<<endl;
cin>>b;
sum=a+b;
cout<<“Sum of both numbers : “<<sum<<endl;
getch();
}
इस उदहारण मे तीन variables को declare किया गया जिनका type integer type है |इसका आउटपुट होगा :
Your First Number : 34
Your Second Number : 45
Sum of both numbers : 79
इस article मे variable का basic ,naming और integer type के basic को discuss किया गया है | integer type के prefix और उदाहरानो  को सार मे C++ : Integer Type मे discuss करेगे |
Sbistudy

Recent Posts

मालकाना का युद्ध malkhana ka yudh kab hua tha in hindi

malkhana ka yudh kab hua tha in hindi मालकाना का युद्ध ? मालकाना के युद्ध…

4 weeks ago

कान्हड़देव तथा अलाउद्दीन खिलजी के संबंधों पर प्रकाश डालिए

राणा रतन सिंह चित्तौड़ ( 1302 ई. - 1303 ) राजस्थान के इतिहास में गुहिलवंशी…

4 weeks ago

हम्मीर देव चौहान का इतिहास क्या है ? hammir dev chauhan history in hindi explained

hammir dev chauhan history in hindi explained हम्मीर देव चौहान का इतिहास क्या है ?…

4 weeks ago

तराइन का प्रथम युद्ध कब और किसके बीच हुआ द्वितीय युद्ध Tarain battle in hindi first and second

Tarain battle in hindi first and second तराइन का प्रथम युद्ध कब और किसके बीच…

4 weeks ago

चौहानों की उत्पत्ति कैसे हुई थी ? chahamana dynasty ki utpatti kahan se hui in hindi

chahamana dynasty ki utpatti kahan se hui in hindi चौहानों की उत्पत्ति कैसे हुई थी…

1 month ago

भारत पर पहला तुर्क आक्रमण किसने किया कब हुआ first turk invaders who attacked india in hindi

first turk invaders who attacked india in hindi भारत पर पहला तुर्क आक्रमण किसने किया…

1 month ago
All Rights ReservedView Non-AMP Version
X

Headline

You can control the ways in which we improve and personalize your experience. Please choose whether you wish to allow the following:

Privacy Settings
JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now