हिंदी माध्यम नोट्स
Structure : Operation or Memory Representation in hindi स्ट्रक्चर : ऑपरेशन या मेमोरी रिप्रजेंटेशन हिंदी में c कंप्यूटर भाषा
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 बाइट कहते है |
Recent Posts
सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है
सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…
मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the
marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…
राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi
sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…
गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi
gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…
Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन
वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…
polity notes pdf in hindi for upsc prelims and mains exam , SSC , RAS political science hindi medium handwritten
get all types and chapters polity notes pdf in hindi for upsc , SSC ,…