JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Categories: c++ language in hindi

C++ : Pointer Arithmetic Operation in hindi , what is Pointer Arithmetic Operations program in c++ language

what is Pointer Arithmetic Operations program in c++ language , C++ : Pointer Arithmetic Operation in hindi :-
इससे पहले के article मे , pointer , new और delete command को discuss किया है अब इस  article मे  pointer addition  और pointer airthmatic को discuss करेगे |
pointer एक एस variable होता है जिसमे किसी variable के address को store किया जाता है | Pointer variable से addition,subtraction और multiplication के प्रोग्राम को discuss करेगे |
C++ मे चार operation मुख्य है :
Addition
subtraction
multiplication
Division
Addition
इस operation मे टो pointer variables की value को  add किया जाता है | इसमें  दो pointer variable की value को add करने के लिए ‘+’ operator का use किया
जाता है | इसमें दो pointer variable को declare करते है | इस variable को ‘+’ के दोनों तरह लिख देते है इसके output को तीरसे variable मे assign कर देते है | इसका उदाहरण  है  :-
#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std;
int *a,b;
int e,f;
cout<<“Enter First Value:”;
cin>>e;
cout<<“Enter Second Value : “;
cin>>f;
a=&e;
b=&f;
int o= *a+*b;
cout<<“Addition of values : “<< o;
getch();
}
इस addition मे दो pointer variable ‘a’ और ‘b’ है जिसमे variable ‘e’ और ‘f’ के address को assign किया जाता है | और o= *a+*b से pointer variable के address पर स्थित values को add किया जाता है | इसका आउटपुट होगा :
Enter First Value : 12
Enter Second Value : 23
Addition of values : 35
इस उदाहरण मे , o= *a+*b confusion create कर देते है |इस confusion को solve करने के लिए निन्म  statement को भी use कर सकते है :
o= (*a)+(*b);
इस method को  सबसे ज्यादा use किया जाता है क्योकि इसमें  + और *b के बीच () है जो की operator precedding से ststement को solve करने आसानी होती है |
Subtraction
इस operation मे टो pointer variables की value को  subtraction किया जाता है | इसमें  दो pointer variable की value को घटाने  के लिए ‘-‘ operator का use किया जाता है | इसमें दो pointer variable को declare करते है | इस variable को ‘-‘ के दोनों तरह लिख देते है इसके output को तीरसे variable मे assign कर देते है | इसका उदाहरण  है  :-
#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std;
int *a,b;
int e,f;
cout<<“Enter First Value:”;
cin>>e;
cout<<“Enter Second Value : “;
cin>>f;
a=&e;
b=&f;
int o = (*a) – (*b);
cout<<“Subtraction of values : “<< o;
getch();
}
इस addition मे दो pointer variable ‘a’ और ‘b’ है जिसमे variable ‘e’ और ‘f’ के address को assign किया जाता है | और o= *a+*b से pointer variable के address पर स्थित values को घटाया  जाता है | इसका आउटपुट होगा :
Enter First Value : 24
Enter Second Value : 23
Addition of values : 1
इस उदाहरण मे , o= *a+*b confusion create कर देते है | इस confusion को solve करने के लिए o= (*a)-(*b);ststement को भी use कर सकते है |
Multiplication
इस operation मे दो या दो से अधिक  pointer variables की value को  multiply किया जाता है | इसमें  दो  pointer variable की value को गुणा  के लिए ‘*’ operator का use किया जाता है | इसमें दो pointer variable को declare करते है | इस variable को ‘*’ के दोनों तरह लिख देते है इसके output को तीरसे variable मे assign कर देते है | इसका उदाहरण  है  :-
#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std;
int *a,*b,*c;
int e,f,h;
cout<<“First Value:”;
cin>>e;
cout<<“Second Value : “;
cin>>f;
cout<<“Third Value : “;
cin>>h;
a=&e;
b=&f;
c=&h;
int o = (*a) * (*b) *(*c);
cout<<“Multiply of values : “<< o;
getch();
}
इस addition मे दो pointer variable ‘a’,’b’ or ‘c’ है जिसमे variable ‘e’,’f’ or ‘h’ के address को assign किया जाता है | और o = (*a) * (*b) *(*c)  से pointer variable के address पर स्थित values को गुणा किया जाता है | इसका आउटपुट होगा :
First Value : 4
Second Value : 2
Third Value : 3
Multiply of values : 24
इस उदाहरण मे , o= *a**b**c ; को प्रोग्रामर द्वारा read करना मुश्किल होता  है | इस confusion को solve करने के लिए  o = (*a) * (*b) *(*c) statement को भी use कर सकते है |
Division
इस operation मे दो pointer variables की value को  भाग दिया जाता है | इसमें  दो  pointer variable की value को भाग  देने   के लिए ‘/’ operator का use किया जाता है | इसमें दो pointer variable को declare करते है | इस variable को ‘/’ के दोनों तरह लिख देते है इसके Qucent को तीरसे variable मे assign कर देते है |  दूसरी variable की value को पहली variable के value मे भाग  दिया जाता है | इसका उदाहरण  है  :-
#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std;
int *a,*b,*c;
int e,f,h;
cout<<“First Value:”;
cin>>e;
cout<<“Second Value : “;
cin>>f;
a=&e;
b=&f;
int o = (*a) / (*b);
cout<<” Qucent of values : “<< o;
getch();
}
इस addition मे दो pointer variable ‘a’,’b’ है जिसमे variable ‘e’,’f’ के address को assign किया जाता है | और o = (*a)/(*b)  से pointer variable के address पर स्थित values को भाग  किया जाता है | इसका आउटपुट होगा :
First Value : 4
Second Value : 2
Qucent of values : 2
इस उदाहरण मे , o= *a/*b ; को प्रोग्रामर द्वारा read करना मुश्किल होता  है | इस confusion को solve करने के लिए  o = (*a) / (*b) statement को भी use कर सकते है |
Division
इस operation मे दो pointer variables की value को  भाग दिया जाता है | इसमें  दो  pointer variable की value को भाग  देने   के लिए ‘%’ operator का use किया जाता है | इसमें दो pointer variable को declare करते है | इस variable को ‘%’ के दोनों तरह लिख देते है इसके remainder को तीरसे variable मे assign कर देते है |  दूसरी variable की value को पहली variable के value मे भाग  दिया जाता है | इसका उदाहरण  है  :-
#include<iostream.h>
#include<conio.h>
void main()
{
using namespace std;
int *a,*b,*c;
int e,f,h;
cout<<“First Value:”;
cin>>e;
cout<<“Second Value : “;
cin>>f;
a=&e;
b=&f;
int o = (*a) % (*b);
cout<<” Qucent of values : “<< o;
getch();
}
इस addition मे दो pointer variable ‘a’,’b’ है जिसमे variable ‘e’,’f’ के address को assign किया जाता है | और o = (*a)%(*b)  से pointer variable के address पर स्थित values को भाग  किया जाता है | और इस भाग का remainder को display करवाता है | इसका आउटपुट होगा :
First Value : 4
Second Value : 2
Qucent of values : 0
इस उदाहरण मे , o= *a%*b ; को प्रोग्रामर द्वारा read करना मुश्किल होता  है | इस confusion को solve करने के लिए  o = (*a)%(*b) statement को भी use कर सकते है |
इस article मे pointer variable से  basic arithmetic operation के प्रोग्राम को discuss किया है अब आगे के article मे pointer variable से string data type को create और access करने के प्रोसेस को discuss करेगे |
Sbistudy

Recent Posts

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

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

23 hours ago

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

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

24 hours ago

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

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

3 days ago

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

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

3 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