JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Categories: C Language in hindi

Structure : Operation or Memory Representation in hindi स्ट्रक्चर : ऑपरेशन या मेमोरी रिप्रजेंटेशन हिंदी में c कंप्यूटर भाषा

स्ट्रक्चर : ऑपरेशन या मेमोरी रिप्रजेंटेशन हिंदी में c कंप्यूटर भाषा Structure : Operation or Memory Representation in hindi :-
Structure initialization : Structure data type को initial करने के लिए निम्न syntax को फॉलो करता है :-
struct address
{
int house ;
int floor;
char street[20];
char city ;
};
void main(){
struct address add 1={ 203 , 1, Sita ram ki gali ,jaipur };
printf(“%d”,add 1.house);
printf(“%d”,add 1.floor);
printf(“[. .]”,add 1.street);
printf(“%s”,add 1.city);
getch();
}Structure initialization मे निन्म syntax होते है :-
struct : struct keyword है |
Structure_name : ये Structure का नाम है |
variable _name : ये variable का नाम है जिसके members मे values को assign करना है |
Assignment operator : इसका use value को Structure में member मे assign करने के लिए किया जाता है |
values : इसमें declare Structureके सभी members के लिए values को {} मे क्लोज करते है |

Structure initialization के कुछ rules :
1.Structure के केवल एक member को initialization नहीं कर सकते है |
2.type और order of values और type और order of Structure member same होनी चाहिए |
3.Structure के कुछ members को  initialization कर सकते है लेकिन Non initialization members Structure के last members होने चाहिए |
4. जब तक Structure को  initialization नहीं करते है तब  तक इसमें default values assign होती है |जैसे
integer के लिए zero
और character or string के लिए null (‘/0’)

Operation :

1.Copying और Comparing
Copying operation :
जब किसी एक Structure को दुसरे Structure मे copy करना होता है ,tab इसे assignment operator से किया जा सकता है |अगर S1 और S2 दो Structure है तब S1=S2 होने पर Structure ‘S2’ की value Structure ‘S1’ मे copy हो जाती है अगर ‘S1’ और ‘S2’ same Structure के variable होते है |

उदहारण के लिए ;
struct address
{
int house ;
int floor;
char street[20];
char city ;
};
void main()
{struct address add1={ 203 , 1, Sita ram ki gali ,jaipur };
struct address add2;
add2=add2;
printf(“%d”,add 2.house);
printf(“%d”,add 2.floor);
printf(“[. .]”,add 2.street);
printf(“%s”,add 2.city);
getch();
}

Comparing
Comparing  operation, copying operation के तरह नहीं होती है |Comparing  operation किसी
Structure के members मे होता है |इसके उदहारण है :-
#include<conio.h>
#include<stdio.h>
#include<string.h>
struct address
{
int house ;
int floor;
char street[20];
char city ;
};
void main()
{struct address add1={ 203 , 1, Sita ram ki gali ,jaipur };
struct address add2={ 34 , 2,Shri ram ki gali ,jaipur };
if(add1.city==add2.city)
{
printf(“A और B are same city %s.”,add1.city);
}
getch();
}

Airthmatic Operation  :
Airthmatic operation किसी Structure के members मे होता है | इसके उदहारण है :-

struct address
{
int house ;
int floor;
char street[20];
char city ;
};
void main()
{struct address add1={ 203 , 1, Sita ram ki gali ,jaipur };
struct address add2={ 34 , 2,Shri ram ki gali ,jaipur };
struct address add3;
add3.street=strcat(add1.street,add2.street);
add3.house=add1.house+add2.house;
add3.city=add2.city;
printf(“%s”,add3.city);
printf(“%d”,add3.floor);
printf(“%[. .]”,add3.street);
getch();
}

Typedef :
Typedef C language का यो keyword है जिससे किसी user define function को नया नाम दे सकते है|typedef  keyword का use Structure के साथ भी कर सकते है |इसका syntax है:-
typedef struct
{
member 1;
member 2;
…………….;
…………….;
member n;
}type_name ;

यह पर type_name का use किसी variable को declare करने के लिए किया जाता है
(i)|typedef के साथ ,हम variable को Structure definition मे define नहीं कर सकते है |
(ii)और type name, type definition name है variable का नहीं |
उदहारण के लिए :
#include<stdio.h>
#include<conio.h>
typedef struct
{
long int mobile ;
char name [15];
int age ;
char sex[5];
}person;
void main()
person person_1;
printf(“Enter name”);
person1.name=gets();
printf(“Enter mobile “);
scanf(“%l”,&person1.mobile);
printf(“Enter age “);
scanf(“dl”,&person1.age);
printf(“Enter sex “);
scanf(“%s”,&person1.sex);
printf(“Profile of %[..]”,person1.name );
printf(“%d”,person1.age);
printf(“%l”,person1.floor);
printf(“%s”,person1.sex);
getch();
}

Memory Representation :
computer, Structure को “word boundaries” के concept से memory allocate करता है |word boundaries की size कंप्यूटर पर निर्भर करती है |
अगर कंप्यूटर जो 2 bytes का है तब Structure की members,word boundaries के left aligned मे store हो जाता है |character data, 1 bytes occupy करता है और integer data, 2 bytes occupy करेगा | इन दोनों के बीच एक empty बिट होती है जिसे slack बाइट कहते है |

Sbistudy

Recent Posts

मालकाना का युद्ध malkhana ka yudh kab hua tha in hindi

malkhana ka yudh kab hua tha in hindi मालकाना का युद्ध ? मालकाना के युद्ध…

4 weeks ago

कान्हड़देव तथा अलाउद्दीन खिलजी के संबंधों पर प्रकाश डालिए

राणा रतन सिंह चित्तौड़ ( 1302 ई. - 1303 ) राजस्थान के इतिहास में गुहिलवंशी…

4 weeks ago

हम्मीर देव चौहान का इतिहास क्या है ? hammir dev chauhan history in hindi explained

hammir dev chauhan history in hindi explained हम्मीर देव चौहान का इतिहास क्या है ?…

4 weeks ago

तराइन का प्रथम युद्ध कब और किसके बीच हुआ द्वितीय युद्ध Tarain battle in hindi first and second

Tarain battle in hindi first and second तराइन का प्रथम युद्ध कब और किसके बीच…

4 weeks ago

चौहानों की उत्पत्ति कैसे हुई थी ? chahamana dynasty ki utpatti kahan se hui in hindi

chahamana dynasty ki utpatti kahan se hui in hindi चौहानों की उत्पत्ति कैसे हुई थी…

1 month ago

भारत पर पहला तुर्क आक्रमण किसने किया कब हुआ first turk invaders who attacked india in hindi

first turk invaders who attacked india in hindi भारत पर पहला तुर्क आक्रमण किसने किया…

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