हिंदी माध्यम नोट्स
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
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…
Translation in english grammer in hindi examples Step of Translation (अनुवाद के चरण)
Translation 1. Step of Translation (अनुवाद के चरण) • मूल वाक्य का पता करना और उसकी…
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…
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…
विश्व के महाद्वीप की भौगोलिक विशेषताएँ continents of the world and their countries in hindi features
continents of the world and their countries in hindi features विश्व के महाद्वीप की भौगोलिक…
भारत के वन्य जीव राष्ट्रीय उद्यान list in hin hindi IAS UPSC
भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…