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

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…

2 weeks ago

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

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

2 weeks 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…

2 weeks 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…

2 weeks ago

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

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

2 weeks ago

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

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

2 weeks 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