हिंदी माध्यम नोट्स
Pointer : Operation और Limitation क्या है , pointer’s operations and limitations in hindi in c language
जिस प्रकार किसी 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”);
}
#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]);
}
#include<stdio.h>
void main()
{
char *a;
int b;
printf(“Enter data”);
scanf(“%d”,b);
a=(char*)&b;
printf(“value of a = %c”,*a);
Recent Posts
मालकाना का युद्ध malkhana ka yudh kab hua tha in hindi
malkhana ka yudh kab hua tha in hindi मालकाना का युद्ध ? मालकाना के युद्ध…
कान्हड़देव तथा अलाउद्दीन खिलजी के संबंधों पर प्रकाश डालिए
राणा रतन सिंह चित्तौड़ ( 1302 ई. - 1303 ) राजस्थान के इतिहास में गुहिलवंशी…
हम्मीर देव चौहान का इतिहास क्या है ? hammir dev chauhan history in hindi explained
hammir dev chauhan history in hindi explained हम्मीर देव चौहान का इतिहास क्या है ?…
तराइन का प्रथम युद्ध कब और किसके बीच हुआ द्वितीय युद्ध Tarain battle in hindi first and second
Tarain battle in hindi first and second तराइन का प्रथम युद्ध कब और किसके बीच…
चौहानों की उत्पत्ति कैसे हुई थी ? chahamana dynasty ki utpatti kahan se hui in hindi
chahamana dynasty ki utpatti kahan se hui in hindi चौहानों की उत्पत्ति कैसे हुई थी…
भारत पर पहला तुर्क आक्रमण किसने किया कब हुआ first turk invaders who attacked india in hindi
first turk invaders who attacked india in hindi भारत पर पहला तुर्क आक्रमण किसने किया…