Structure In C In Hindi|C me structure kya Hota hai?

हेलो friends , आज के इस blog post(Structure In C In Hindi) में मैं आप लोगो को ‘Structure in C In Hindi ‘ के बारे में बताने वाला हूँ| स्ट्रक्चर एक user-define datatype होता है जो अलग अलग तरह के data type को एक साथ store कर सकता है, जैसे कि हम array में data स्टोर करते है, पर array के case में, …..

एक array में store होने वाला data एक ही टाइप का होता है, बल्कि Structure का use करके हम कई सरे data types वाले data को एक साथ रख सकते है और उन्हें प्रोग्राम में use कर सकते है |Structure In C In Hindi|

Structure(Structure In C In Hindi) अलग अलग प्रकार के समूह होते है | जो किसी एक single नाम के अंतर्गत define किये जाते है | इन्हे user define data type के अंतर्गत define कर सकते है |

Name sohan;
age 20;
sex male;
code MK004;
Add Gali no. 356;
Fee 500;

इसमें प्रत्येक variable Structure का member होता है | जो एक Structure name को refer करता है | Structure define करने के लिए सबसे पहले Structure variable डिफाइन करते है |

इसके बाद curly braces start करते है | तथा member variable टाइप करते है | फिर curly braces बंद करके Structure variable type करते है |Structure In C In Hindi|

syntax:

Structure Name{
member name-1
member name-2
}
varibale-1, variable-2;

Program1: Structure

#include<stdio.h>
#include<conio.h>
void main(){
struct value
{
int a,b;
}val;
val.a = 50
val.b = 60

printf(“value of a is = %d”, val.a);
printf(“value of b is = %d”, val.b);
getch();
}

Program:2 Structure Program

#include<stdio.h>
#include<conio.h>
void main()
{
Struct employee
{
char n;
int age;
char sex;
int code;
char add;
int fee;
}
emp;
clrscr();
print(“Enter the name of employee\n”);
scanf(“%s”, &emp.n)

printf(“Enter the age\n”);
scanf(“%d”, &emp.age);

printf(“Enter the sex\n”);
scanf(“%s”, &emp.sex);

printf(“enter the code\n”);
scanf(“%d”, &emp.code);

printf(“Enter the address\n”);
scanf(“%S”, &emp.add);

printf(“Enter the fee\n”);
scanf(“%d”, &emp.fee);

printf(“employee name = %s”, emp.n);
printf(“employee age = %d”, emp.age);
printf(“employee sex = %s”, emp.sex);
printf(“employee code = %d”, emp.code);
printf(“employee address = %s”, emp.add);
printf(“employee fee = %d”, emp.fee);

getch();

}

initialization of Structure member :

Structure में define किये प्रत्येक member variable के लिए value प्रदान करने की प्रक्रिया Structure initialization कहलाती है |

Ex: Program for initialization of structure member

void main()
{
struct employee{
int code;
int age;
char sex;
float salary;
}

emloyee emp = {100, 22. f, 5000};
printf(“The asigned value are\n”);
printf(“employee code = %d\n”, emp.code);
printf(“employee age = %d\n”, emp.age);
printf(“employee sex = %s\n”, emp.sex);
printf(“employee salary = %d\n”, emp.salary);

getch();
}

Nested Structure:

Structure के अंतर्गत किसी दूसरे Structure को define करके हम programming में उसे कर सकते है | यह प्रक्रिया nested Structure कहलाती है |

Syn:

Struct name1
{ variable and member
}
Struct name2
{variable and member
}

Program for Nested Structure

program: Nested Structure

#include<stdio.h>
#include<conio.h>
Struct DOB{
int mm;
int dd;
int yy;
}
Struct Stud
{
int roll;
char name[20];
dob date of birth;
}
st;
void main()
{
printf(“enter the roll no.\n”)
scanf(“%d”, &roll);

printf(“enter the name\n”)
scanf(“%s”, &name);

printf(“enter the month of birth\n”)
scanf(“%d”, st.month of birth.mm );

printf(“enter the day of birth\n”)
scanf(“%d”, st.day of birth.dd);

printf(“enter the year of birth\n”)
scanf(“%d”, st.day of year.yy);

printf(“Your name is = %s”, st.Name);
printf(“Your roll number is = %d”, st.Name);

printf(“Your month of birth is = %d”, st.date of birth.mm);

printf(“Your day of birth is = %d”, st.date of birth.dd);

printf(“Your year of birth is = %d”, st.date of birth.yy);

getch();

}

You can also go through a few more amazing blog links related to C/C++:

Array In C In Hindi…
Function In C In Hindi…
Fundamentals Of C In Hindi…
Preprocessor Directives Of C In Hindi…
History And Introduction of C Language In Hindi…
Structure In C In Hindi…

इस ब्लॉग(Structure In C In Hindi) को लेकर आपके मन में कोई भी प्रश्न है तो आप हमें इस पते a5theorys@gmail.com पर ईमेल लिख सकते है|

आशा करता हूँ, कि आपने इस पोस्ट ‘Structure In C In Hindi : initialization and nested structure’ को खूब एन्जॉय किया होगा|

आप स्वतंत्रता पूर्वक अपना बहुमूल्य फीडबैक और कमेंट यहाँ पर दे सकते है|Structure In C In Hindi|

आपका समय शुभ हो|

Anurag

I am a blogger by passion, a software engineer by profession, a singer by consideration and rest of things that I do is for my destination.