हिंदी माध्यम नोट्स
Categories: C Language in hindi
Pointer in c language in hindi पॉइंटर क्या है c कंप्यूटर भाषा में हिंदी में , pointer कैसे कार्य करता है
पॉइंटर क्या है c कंप्यूटर भाषा में हिंदी में , pointer कैसे कार्य करता है Pointer in c language in hindi :-
Pointer : pointer एक derived data type है | ये किसी fundamental datatype से बनता है pointer एक वक datatype है जिसमे memory address store होता है |ये memory location कंप्यूटर memory मे space होती है जिसमे data या instruction store होते है |
Insight of Pointer :
कंप्यूटर memory दो या दो अधिक storage cells का sequential collection होता है|एक cell, बाइट से जनि जाती है जो की किसी न किसी address से associate होती है |mostly address integer होते है जो 0 start होता है और last address machine पर निर्भर करता है |
जब हम किसी variable को declare करते है तब कंप्यूटर memory मे एक space allocate कर देता है जो की उस variable की value store करता है |सभी बाइट का एक अनोखा address होता है |जैसे
int variable_1=123;
यह variable_1. variable का नाम है जो की किसी किसी address से associate होता है |जैसे की memory address 300 है |तब variable_1 हमसे address 300 से associate होता है|जब भी ये statement execute होता है तब 123 value memory मे 300 address पर store हो जाती है जो की variable_1 से associate है |
इस तरह ,address एक number होता है जिसे किसी variable मे store करा कर memory मे store कर सकते है |अतः ये variable जो किसी variable के address को store करता है उसे pointer कहते है |
उदाहरन के लिए:
जब variable_1 के लिए कोई pointer named pointer p1 assign किया गया जाता है |p1 कोई variable है जो की variable_1 की address 300 store होती है |
इस concept से तीन keyword मिलते है :-
1.Pointer constant:Memory address जो की कंप्यूटर assign करता है उसे Pointer constant कहते है |इसकी value change नहीं हो सकती है |
2.Pointer values:हम Pointer constant को directly store नहीं कर सकते है |अतः address operator से Pointer constant की value find की जाती है उस value को Pointer values कहते है |Pointer values अलग अलग हो सकते है |
3.Pointer variable: Pointer values को जिस variable मे store करते है उसे Pointer variable कहते है |
How to find address of variable ?
किसी variable की actual address ,computer system पर निर्भर करता है |C language मे, address को directly find नहीं कर सकते है |इसके लिए address operator ( & ) को use करते है |इससे पहले हम scanf() function statement मे कई बार use किया है | इसका syntax है :-
& variable_2;
यहा पर
variable_2 : variable_2 उस variable का नाम है जिसका address पता लगना है |
Address operator का अलग अलग use :
&23 : ये किसी constant का address है |
&a : ये किसी integer variable (जिसका नाम a है) का address को point करता है |
&a[1]: ये array named a[ ] के first position के variable के address को point करता है |
&(a+b); ये किसी expression a+b के आउटपुट का address को point करता है|
उदाहरण है :
#include<stdio.h>
#include<conio.h>
void main()
{
int a=12;
int a=12;
int b=56;
int c[5];
printf(“Address of variable a = %d”,&a);
printf(“Address of first element of array = %d”,&c[1]);
printf(“Address of expression = %d”,&(a+b));
getch( );
}
आउटपुट होगा :
Address of variable a = 4436
Address of first element of array = 4440
Address of expression = 4448
Pointer Declaration :
Pointer एक variable है जो किसी variable के address को store करता है |इसलिए इसे use करने से पहले declare करना पड़ता है |इसका syntax है :
data type * pointer_name ;
यहा पर :
pointer_name : pointer_name pointer का नाम होता है जो की character , string या alphanumerical हो सकता है |
‘*’ : ये pointer का keyword है जिसे asterisk कहते है |
data type : Pointer का data type है जो ये बताता है की pointer मे किस प्रकार की value store हो सकती है |जैसे
int *a; // ये integer pointer है क्योकि इसका datatype integer है | //
float * b ; // ये float pointer है जिसका नाम b और datatype float है|//
किसी pointer को तीन स्टाइल से declare कर सकते है तीनो स्टाइल के declaration से निन्म है :-
int* a;
int *a;
int * a;
तीनो ही declaration मे asterisk (*) की position अलग अलग है (i) datatype के साथ है |(ii) pointer name के साथ होते है |(iii) data type और pointer variable के बीच होते है |
Second वाला method more popular होता है क्योकि इस method मे दो या दो से अधिक variable को एक सतह declare कर सकते है |
int *a, b ,*c;
इस statement मे , तीन variable को declare किया गया है जिसका datatype integer है |a और c एक pointer variable है और b एक normal variable है |
Pointer के advantage :
1.Pointer से array और data table को easily handle कर सकते है |
2.Pointer से हम multiple values return हो सकती है |
3.Pointer array से string को handle करने से storage space कम हो जाता है |
4.Pointer का dynamic memory management से manage होता है |
5.Pointer से stack ,queues,trees को handle कर सकते है |
6.Pointer से C प्रोग्राम की length , complexity कम हो सकती है |
6.Pointer से C प्रोग्राम की length , complexity कम हो सकती है |
7.Execution Speed बढ़ जाती है |
आगे article मे , हम pointer initialization और accessing को पड़ेगे |
Recent Posts
Question Tag Definition in english with examples upsc ssc ias state pcs exames important topic
Question Tag Definition • A question tag is a small question at the end of a…
2 weeks ago
Translation in english grammer in hindi examples Step of Translation (अनुवाद के चरण)
Translation 1. Step of Translation (अनुवाद के चरण) • मूल वाक्य का पता करना और उसकी…
2 weeks ago
Report Writing examples in english grammer How to Write Reports explain Exercise
Report Writing • How to Write Reports • Just as no definite rules can be laid down…
2 weeks ago
Letter writing ,types and their examples in english grammer upsc state pcs class 12 10th
Letter writing • Introduction • Letter writing is an intricate task as it demands meticulous attention, still…
2 weeks ago
विश्व के महाद्वीप की भौगोलिक विशेषताएँ continents of the world and their countries in hindi features
continents of the world and their countries in hindi features विश्व के महाद्वीप की भौगोलिक…
2 weeks ago
भारत के वन्य जीव राष्ट्रीय उद्यान list in hin hindi IAS UPSC
भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…
2 weeks ago