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

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…

1 day ago

Translation in english grammer in hindi examples Step of Translation (अनुवाद के चरण)

Translation 1. Step of Translation (अनुवाद के चरण) • मूल वाक्य का पता करना और उसकी…

1 day 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…

1 day 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…

1 day ago

विश्व के महाद्वीप की भौगोलिक विशेषताएँ continents of the world and their countries in hindi features

continents of the world and their countries in hindi features विश्व के महाद्वीप की भौगोलिक…

1 day ago

भारत के वन्य जीव राष्ट्रीय उद्यान list in hin hindi IAS UPSC

भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…

1 day 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