C++ : Structure with Pointer with program example , what is Structure with Pointer in c++ language in hindi

what is Structure with Pointer in c++ language in hindi , C++ : Structure with Pointer with program example :-
इससे पहले एक article मे string को pointer variable से declare और access करने के लिए प्रोसेस को discuss किया है अब इस article मे structure मे pointer variable से  initail ओए access करने के प्रोसेस को discuss किया गया है |
structure
struture  एक mixed data type होता है जिसमे कई दो या दो से अधिक डट type के variable को member की तरह hold कर सकते है | उदाहरण के लिए time एक structure है जिसमे hour value ,minute value और second value को रखता है | structure data type एक यूजर define data type भी कहते है | क्योकि structure  के type के दुसरे variable को declare किया जाता है | इस प्रोसेस को समजने के लिए निन्म उदाहरण को consider करेगे :-
#include<iostream.h>
#include<conio.h>
#include<string.h>
struct time
{
int hour ;
int minute;
int second;
};
void main()
{
using namespace std;
time t;
cout<<“Enter hour Value :”<<endl;
cin>>t.hour;
cout<<“Enter Minute Value :”<<endl;
cin>>t.minute;
cout<<“Enter Second Value :”<<endl;
cin>>t.second;
cout<<“Time :”<< t.hour:t.minute : t.second <<endl;
getch();
}
इस उदाहरण मे time एक structure है जिसमे तीन member है :-
hour : इसमें hour value को assign किया जाता है|
minute : इसमें minute value को assign किया जाता है |
second : इसमें second value assign किया जाता है |
t.hour  का मतलब है की time variable के member hour हो access किया जाता है | और t.minute से time variable के minute member को access करते है |
structure with new operator
new operator से string को declare किये जाता है और new operator से array को declare करने से complie time पर , array को create नहीं किया जाताहै |और new operator से  run time मे array को create किया जाता है | जब किसी  structure को run time मे allocate किया जाता है तब इसके लिए new operator को use किया जाता है | इसे dynamic structure कहते है | यहा पर dynamic का मतलब है र्रून time पर struture को के लिए memory space को allocate किया जाता है |
structure को new operator से allocate किया जाता है :
inflatable *pointer name = new inflatable;
यहा पर
inflatable : ये structure  का नाम होता है जिसके लिए memory space को define किया जाता है |
pointer name : ये pointer का नाम है |जिसमे structure  का मेम्रोरी address store होता है |
new : ये key word है जिसका use new operator के use करने के लिए किया जाता है |
new operator से structure मे दो operation हो सकता है :
1. create
2. Access
किसी structure को pointer variable से create करने के लिए new operator का use किया जाता है | और किसी structure के member को access करने के लिए डॉट operator का use नहीं किया जाता है | इसके लिए c++ मे (->) का use किया जाता है | इसे arrow membership operator कहते है |  इसका उदाहरण के लिए :
#include<iostream.h>
#include<conio.h>
#include<string.h>
struct time
{
int hour ;
int minute;
int second;
};
void main()
{
using namespace std;
time *t = new time;
cout<<“Enter hour Value :”<<endl;
cin>>(*t)->hour;
cout<<“Enter Minute Value :”<<endl;
cin>>(*t)->minute;
cout<<“Enter Second Value :”<<endl;
cin>>(*t)->second;
cout<<“Time :”<< (*t)->hour:(*t)->minute : (*t)->second <<endl;
getch();
}
इस उदाहरण मे time एक structure है जिसमे तीन member है :-
hour : इसमें hour value को assign किया जाता है|
minute : इसमें minute value को assign किया जाता है |
second : इसमें second value assign किया जाता है |
इसमें  pointer variable जिसका type time data type है  | इस variable मे new operator से memory space के address को store किया जाता है |
(*t)->second : t pointer variable के second member को access करते है |
New और delete operator
जब किसी प्रोग्राम मे new operator को use किया जाता है | तब delete operator को use किया जाता है |  अब इस उदाहरण मे , new और delete operator के द्वारा  किसी string मे data को store किया जाता है | और get() function से एक pointer को return करते है जिसमे string को return किया जाता है |इस उदाहरण मे , एक temporary array मे यूजर द्वारा input string को read किया जाता है | और new [] operator से  एक string को declare किया जाता है | जिसे एक pointer variable मे assign किया जाता है |
उदहारण के लिए , अगर किसी प्रोग्राम मे 1000 string को read करना है और सबसे बड़ी string 79 character hold करती है तब अगर character array को use किया जाता है |तब 1000*80=80,000 bytes की जरुरत होती है | जो की बहुत बड़ी मेम्रोरी space है | इस प्रॉब्लम को solve करने के लिए char type के 1000 pointer को create किया जाता है | और new operator से केवल उन्ही string के लिए space को allocate करते है |जिन्हें use करना है |
उदाहरण :
#include<iostream.h>
#include<conio.h>
#include<string.h>
char *get(void);
void main()
{
char *n;
n=get();
cout<<n << “at”<<(int*)n;
delete[] n;
n= get();
cout<<n<<“at”<<(int*)n;
delete[]n;
getch();
}
char *get()
{
char temp[30];
cout<<“Enter Name :”<<endl;
cin>>temp;
char *p=new char[strlen(temp)+1];
strcpy(p,temp);
getch();
}
इस article मे ,  pointer variable से structure को initial और access करने के प्रोसेस को discuss किया गया है | अब आगे के article मे  c++ operator के relation operator को discuss करेगे |