JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi sociology physics physical education maths english economics geography History

chemistry business studies biology accountancy political science

Class 12

Hindi physics physical education maths english economics

chemistry business studies biology accountancy Political science History sociology

Home science Geography

English medium Notes

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Class 12

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Categories: c++ language in hindi

C++ : Pointer in hindi , what is pointer in c++ language with examples computer programe

what is pointer in c++ language with examples computer programe , C++ : Pointer in hindi :-
इससे पहले के article मे string और structure को discuss किया गया है |अब इस article मे , pointer को discuss करेगे |
isse पहले के article मे , किसी variable के information को हमेशा ट्रैक किया जाता जाता ये information होती है जैसे
1.values कहा store होती है ?
2.value किस तरह की होती है ?
3.value क्या है ?
इस तरह के operation को पूरा करने के लिए simple variable को डेफिन किया जाता है |Declaration statement मे variable का type और name store होता है | जो की कंप्यूटर memory मे एक सप्चे को allocate करता है जिसको इंटरनल ट्रैक किया जाता है |
इसके अलावा C++ मे , इस operation के लिए class को define किया जाता है |इसमें pointer को use किया जाता है |जोकि किसी variable के address को store करता है |किसी variable के address को access करने के लिए address operator का use किया जाता है | अगर variable का नाम ‘a’ है और variable का address ‘&a’ को access करते है |
उदाहरण के लिए :
#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std ;
int a ;
cout<<“Enter value :”<<endl;
cin>>a;
cout<<“value of ‘a’ :”<<a<<endl;
cout<<“Address of ‘a’ : “<< &a << endl;
getcch();
}
इस उदाहरण मे , ‘a’ एक variable है जिसका data type , integer होती है |
cout<<“value of ‘a’ :”<<a ; से variable ‘a’ की value को display किया जाता है |
cout<<“Address of ‘a’ : “<< &a ; से variable ‘a’ के address को display किया जाता है |
इसका आउटपुट होगा :
Enter value : 12
value of ‘a’ : 12
Address of ‘a’ : 0x0065fd40   // यहा पर 0x0065fd40 integer ‘a’ का memory address है |
c++ मे cout statement , memory address को hexadecimal form मे define करता है | किसी डट type के size को define करने के लिए highest value के memory address और lowest value के address को minus करते है | लेकिन दोनों ही variable के type सामान होना चाहिए |
Pointer Declaration
Pointer declaration को समजने के लिए निन्म उदाहरण को discuss किया जाता है :-
#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std ;
int a ;
int *p;
p=&a;
cout<<“Enter value :”<<endl;
cin>>a;
cout<<“value of ‘a’ :”<<a<<endl;
cout<<“Address of ‘a’ : “<< &a << endl;
cout<<“value of ‘p’ :”<<*p<<endl;
cout<<“Address of ‘p’ : “<< &p<< endl;
*p=*p+1;
cout<<“value of ‘p’ :”<<*p<<endl;
getcch();

 

}
इस उदाहरण मे ,pointer को निन्म तरह से declare किया गया है :
int *p;
इसमें ‘p’ एक pointer है जिसका type integer है | अतः ये integer value के address को hold कर सकता है | इसके अलावा किसी दुसरे type की pointer variable को declare करने के लिए :
char *c;
double *d;
char *c;-इसमें ‘c’ एक pointer है जिसका type character है | अतः ये character value के address को hold कर सकता है |
double *d;-इसमें ‘d’ एक pointer है जिसका type double है | अतः ये double value के address को hold कर सकता है |
इस उदाहरण के आउटपुट मे , *p और ‘a’ की value सामान होती है क्योकि p pointer variable है जो की variable ‘a’ की address को hold करता है *p से pointer variable मे store address पर स्थित value को access किया जाता है |
किसी pointer variable मे value को assign करने के लिए *p का use किया जाता है |
इसका आउटपुट होगा :
Enter value : 12
value of ‘a’ : 12
Address of ‘a’ : 0x0065fd40
value of ‘p’ : 12
Address of ‘p’ : 0x0065fd42
value of ‘p’ : 13

इसके अलावा निन्म rules को भी pointer declartion मे consider किया जाता है :-
pointer declaration मे space को use करना थोडा confusion होता है | अतः इसे declare करने के लिए निन्म rules को define किया जाता है :-
1.data  type और * के बीच space हो सकता है |
int *p;
2.* और variable  के बीच space हो सकता है |
int* p;
3.लेकिन अगर हम निन्म syntax को use करते है तब
int* p, a;
यहा पर ‘p’ एक pointer variable है लेकिन ‘a’ एक pointer variable नहीं है |
4.अगर अलग अलग pointer को define करने के लिए अलग अलग declarion को use किया जा सकता है :-
int *p;
char *c;
यह int ये भी define कर रहा ‘p’ की size 4 bytes होगी |
और char define करता है ‘a’ की size 2 bytes होगी |

Pointer Danger
pointer के use बहुत संभाल के करना चाहिए | जब हम किसी pointer variable को declare करते है तब ये ध्यान मे रखना चाहिए :- pointer variable एक memory address को store करने के लिए space को generate करता है इसमें value assign नहीं होती है | उदाहरण के लिए
int *p;
*p=1200;
ये syntax possible नहीं क्योकि pointer को initial ही नहीं किया गया है |1200 भी एक address नहीं है | 1200 , pointer variable मे store address पर assign होगा |

 pointer का उदाहरण :

#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std ;
int a,c ;
int *p;
int *b;
p=&a;
b=&c;
cout<<“Enter value :”<<endl;
cin>>a;
cout<<“Enter value :”<<endl;
cin>>c;
*p=*p+*b;
cout<<“Addition Output :”<<*p<<endl;
getcch();
}
इस उदाहरण मे , addition operation को pointer variable से solve किया गया है |
इस article  मे हमने pointer के basic को discuss किया है |अब आगे के article मे pointer के advance topic को discuss करेगे |
Sbistudy

Recent Posts

द्वितीय कोटि के अवकल समीकरण तथा विशिष्ट फलन क्या हैं differential equations of second order and special functions in hindi

अध्याय - द्वितीय कोटि के अवकल समीकरण तथा विशिष्ट फलन (Differential Equations of Second Order…

2 hours ago

four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं

चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…

3 days ago

Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा

आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…

5 days ago

pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए

युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…

1 week ago

THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा

देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…

1 week 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