JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Categories: C Language in hindi

Pointer : Operation और Limitation क्या है , pointer’s operations and limitations in hindi in c language

pointer’s operations and limitations in hindi in c language Pointer : Operation और Limitation क्या है :-
इसके पहले article मे pointer को declare करना ,initial करना और access करना सिखा |अब इस article मे , हम pointer expression ,operation और Limitation  को पड़ेगे |1.Pointer Expression
जिस प्रकार किसी variable को expression मे use कर सकते है उसी प्रकार pointer variable को expression मे use कर सकते है |सभी arithmetic operation pointer के साथ perform कर सकते है |जैसे
‘a’ और ‘b’ एक well define pointer है ओए initial proper है तब नीचे दिए गए statement/expression है :-
(i) y=**a+*b;
इस statement से दोनों  pointers की value का addition operation perform होगा |
(ii) sum=sum+*a;
इस statement से pointer a की value से variable sum की value मे addition होता है |
(iii) d=*a * *b;
इस statement से pointer a और b की value multiply होगी | इसे निन्म तरह से भी लिख सकते है |
d=(*a)*(*b);
(iv) c=*a/*b;
इस statement से pointer a और b की value मे division होगा |
(v) e=8* -*a**b;
ये statement गलत है क्योकि 8 के बाद ‘*’ और ‘-‘ के बीच space है जो की case sensitive होता है|

C language मे pointers का addition कर सकते है और pointer की value किसी constant मे से add या subtraction कर सकते है |

जब कभी किसी array के दो pointers ‘a’ और ‘b’ है मतलब एसे pointer जिसमे एक array के दो elements के address को store करता है तब a-b उस array के बीच वाले array के element कोshow करता है |जैसे

Pointer पर shorthand operator भी use कर सकते है |जैसे
sum+=a;    या   sum=sum+a;
*a+=*b;     या    *a=*a+*b;

Arithmetic operator के अलावा logical operator ( ==,>=,<=,<,> )pointer की value पर perform हो सकता है जैसे
if(*a<*b)
{
printf(“address of a is less than address of b”);
}
{
printf(“address of a is greater than address of b”);
}
उदहारण के लिए:
#include<conio.h>
#include<stdio.h>
vopid main()
{
int *a,*b;
int e,f,g,h,i;
printf(“Enter Data”);
scanf(“%d %d”,&e,&f);
a=&e;
b=&f;
g=*a-*b;
h=*a+*b;
i=*b+454-*a+345;
printf(“%u-%u=%d”,&e,&f,g);
printf(“%u+%u=%d”,&e,&f,h);
printf(“%u+454-%u+345=%d”,&e,&f,i);
if(*a>*b)
{
printf(“address of a is greater than address of b”);
}
{
printf(“address of a is less than address of b”);
}

getch();
}
आउटपुट होगा :
4842-4840=2
4842+4840=9680
4842+454-4840+345=801
address of a is less than address of b
Pointer Increment
Statements
int *a;
a++;
जब ये statements execute होगे तब pointer variable की initial value 4330 है जब a++; execute होगी तब point variable की value ‘1’ से नहीं ‘2’ से increment होता है |और pointer variable की value 4332 हो जाती है |
अतः जब भी किसी pointer variable मे increment और decrement होता  है तब इसकी length से  increment और decrement होता है |इस length को scale भी कहते है |
अलग अलग data type के लिए scale की value है :-
1.    Character : 1 bytes
2.     Integer    : 2 bytes
3.     float        : 4 bytes
4. long integer: 4 bytes
5.  double       : 8 bytes
उदहारण के लिए:
उदहारण के लिए:
#include<conio.h>
#include<stdio.h>
vopid main()
{
int *a;
char *b;
int e,f,i,g[10],h[10];
printf(“Enter one integer or charecter”);
scanf(“%d %c”,&e,&f);
a=&e;
b=&f;
for(i=0;i<10;i++)
{
f[i]=*a;
a++;
h[i]=*b;
b–;
}
for(i=0;i<10;i++)
{
printf(“%d”,f[i]);
}
for(i=0;i<10;i++)
{
printf(“%d”,h[i]);
}
getch();
}
Compatibility or Type casting :
सभी pointer variable किसी किसी ना data type से associate होता है |हम किसी दुसरे data type के pointer को किसी दुसरे data type के pointer मे assign नहीं कर सकते है | दोनों ही variable अपने अपने memory address रखते है इस property को incompatibility कहते है |
Incompatibility की प्रॉब्लम को solve करने के लिए type casting use की जा सकती है |इसके लिए cast operator कहते है इसका syntax है :-
(cast type *)address of variable;
यहा पर :
cast type: ये वो data type जिसमे address ऑफ़ variable को cast करना चाहते हो |इसका data type assign variable के समान होता है |
इसका उदहारण है :
#include<conio.h>
#include<stdio.h>
void main()
{
char *a;

int b;
printf(“Enter data”);
scanf(“%d”,b);
a=(char*)&b;
printf(“value of a = %c”,*a);
getch();
}
इस उदाहरन मे , ‘a’ एक pointer variable है जिसका data type character है |और b एक variable जिसका datatype integer है |
और variable ‘b’ का address जो एक integer है को pointer variable ‘a’ मे store करने के लिए casting का use करना पड़ेगे |
3.Void Pointer
void pointer एक एस pointer है जिसमे किसी भी data type के variable के address को store किया जा सकता है |इसे generic pointer कहते है |इसक syntax है :-
void *p;
इस syntax मे, p एक pointer है जिसका दत्त type void है |
Pointer की limitation:
Pointer c language को flexibility और powerful बनता है लेकिन इसका इस्तेमाल बहुत carefully करना पड़ता है क्योकि pointer की error को c कोम्प्लिएर read नही कर सकता है |
1.Assigning value
जब कभी किसी variable को pointer initialization के बाद मे declare करने पर errornousआउटपुट आता है |
2.किसी uninitialized pointer को value assign करने पर
3. किसी pointer variable पर value assign करने पर
4. किसी pointer मे  uninitialized variable के address को assign करने पर
5.दो अलग अलग pointer को compare करने पर
6. Dereferencing नहीं करने पर यानि printf() statement मे Dereference operator का use नहीं करना |
Sbistudy

Recent Posts

सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है

सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…

18 hours ago

मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the

marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…

18 hours ago

राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi

sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…

2 days ago

गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi

gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…

2 days ago

Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन

वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…

3 months ago

polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten

get all types and chapters polity notes pdf in hindi for upsc , SSC ,…

3 months 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