JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi sociology physics physical education maths english economics geography History

chemistry business studies biology accountancy political science

Class 12

Hindi physics physical education maths english economics

chemistry business studies biology accountancy Political science History sociology

Home science Geography

English medium Notes

Class 6

Hindi social science science maths English

Class 7

Hindi social science science maths English

Class 8

Hindi social science science maths English

Class 9

Hindi social science science Maths English

Class 10

Hindi Social science science Maths English

Class 11

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Class 12

Hindi physics physical education maths entrepreneurship english economics

chemistry business studies biology accountancy

Categories: C Language in hindi

Pointer In Structure (Data Type) in hindi in c language पॉइंटर को स्ट्रक्चर के रूप में कैसे काम में लेते है

पॉइंटर को स्ट्रक्चर के रूप में कैसे काम में लेते है Pointer In Structure (Data Type) in hindi in c language :-
Pointer As structure : जिस प्रकार से array name कसी array के first element के address को
contain करते है उसी प्रकार structure data type मे भी array ऑफ़ structure के
first variable के address को contain करता है |
जैसे
struct add{
int house ;
char street _name [20];
int pin_code ;
char city[15]
}add[2],*a;
इस उदाहरण मे add एक structure होते है जिसमे house ,street_name ,pin_code
और city जो की अलग अलग data type के है को contain करता है |
int house : ये integer data type है इसमें house no की value सेव
होती है |
char street_name[]:ये string है जिसमे address का street name store
होता है |
int pin_code : ये भी integer data type है जिसमे की pin code की
value store होगी |
char city[] :ये string है जिसमे city का नाम store होता है |
memeber block के बाद , add[2], structure add का array है जो की तीन structure
add data type store कर सकता है |इस array को handle करने के लिए pointer ‘a’ को
use किया जाता है |
a=add;
इस statement से,structure add के type का पहले variable ‘add[o]’ का
address store होता है |जब a++;
statement execute होने पर , record 2 (array add[1]) की
address मे increment हो जायेगा |और pointer ‘a’ मे array element a[1] का address
store हो जायेगा |
जैसे
a=a[0] का address
a+1 पर ,a=a[1] का address
a+2 पर a=a[2] का address
जब किसी structure के members को access करने के लिए arrow operator (‘->’) का use करा सकते है इसे members selection
operator कहते है |
a->street_name का मतलब है record 1,a[0] का memeber street_name
सेलेक्ट होगा |
a->city का मतलब है record
1,a[0] का memeber city सेलेक्ट होगा |
जब a++ होने के बाद
a->street_name का मतलब है record 2,a[1] का member street_name सेलेच्व्त करने पर |
a->city का मतलब है record 2, a[1] का memeber city सेलेक्ट होगा |
a-.>city को हम a[0]. भी लिख सकते है |
उदहारण के लिए
#include<conio.h>
#include<stdio.h>
Struct book
{
Char book_name [20];
Int publish_year ;
Char author [20];
Int price;
} bok[2],b;
Void main ()
{
Printf(“data”);
For (b=bok;b<bok+3;b++)
{
Scnaf(“%s %d %s %d”,bok->book_name,bok->publish_year,bok->author,bok->price);
}
Printf(“Output Data”);
For (b=bok;b<bok+3;b++)
{
printf(“Book name:%s ,Publish Year:%d ,Author name:%s ,Price:%d”,bok->book_name,bok->publish_year,bok->author,bok->price);
}
getch();
}
इस उदहारण मे ,दो
record सेव होगे इसलिय इसमें structure data type ‘book’ के दो variable का array
को use करता है |जैसे
जब pointer variable की value bok [0] का address होगा tab record 1 मे data read होगा |
after increment ,pointer variable मे bok[1] का address होगा तब
record 2 मे data read होगा |
आउटपुट होगा
Data
The fire wings 2008 Abdul kalam 230
The half girlfriend 2009 Cheten Bhagat 250
Output
Book name :The fire wings, Publish Year:2008 Author name: Abdul
kalam Price:230
Book name :The half girlfriend, Publish Year:2009 Author name:Chaten
Bhagat Price:250

Sorting Program
जब किसी array के element को sort किया जाता है तब उस प्रोग्रम को pointer से easily handle हो सकता  है |
source code
#include<conio.h>
#include<stdio.h>
void sort(int ,int *);’
void main()
{
int i;
int size=8;
int d[8]={12,56,23,45,76,65,96,32};
sort (size,a);
printf(“Sorted Array “);
for(i=0;i<8;i++)
{
printf(“%d”,d[i]);
}
getch();
}
void sort (int n,int *a)
{
int e,f,t;
for(e=1;e<=n-1;e++)
{
for(f=1;f<n-1;f+
{
if(*(a+f-1)>=*(a+f))
{
t=*(a+f-1);
*(a+f-1)=*(a+f);
*(a+f)=t;
}
}

इस प्रोग्रम मे array को function argument मे pass करते है |और pointer variable ‘a’ मे receive कर देते है |comparison और swapping प्रोसेस मे pointer variable की value को use किया है जो की array element के address है |

आउटपुट होगा :
Sorted Array
96 76 65 56 45 32 23 12

Sbistudy

Recent Posts

four potential in hindi 4-potential electrodynamics चतुर्विम विभव किसे कहते हैं

चतुर्विम विभव (Four-Potential) हम जानते हैं कि एक निर्देश तंत्र में विद्युत क्षेत्र इसके सापेक्ष…

3 days ago

Relativistic Electrodynamics in hindi आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा

आपेक्षिकीय विद्युतगतिकी नोट्स क्या है परिभाषा Relativistic Electrodynamics in hindi ? अध्याय : आपेक्षिकीय विद्युतगतिकी…

4 days ago

pair production in hindi formula definition युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए

युग्म उत्पादन किसे कहते हैं परिभाषा सूत्र क्या है लिखिए pair production in hindi formula…

7 days ago

THRESHOLD REACTION ENERGY in hindi देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा

देहली अभिक्रिया ऊर्जा किसे कहते हैं सूत्र क्या है परिभाषा THRESHOLD REACTION ENERGY in hindi…

7 days ago

elastic collision of two particles in hindi definition formula दो कणों की अप्रत्यास्थ टक्कर क्या है

दो कणों की अप्रत्यास्थ टक्कर क्या है elastic collision of two particles in hindi definition…

7 days 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