हिंदी माध्यम नोट्स
Array : One Dimension Array in hindi 1D arrey in c language 1D अर्रे इन हिंदी भाषा
दो या दो से अधिक datatype को handle (Processing,Reading,Printing) करने के लिए एक powerful datatype की आवश्कता है |C language मे भी derived data type होता है |derived data type को तीन प्रकार होते है |
1.Derived Types :
ये C कंप्यूटर मे Pre define data type होते है |लेकिन ये dynamic होते है |इसमें एक ही variable मे दो से अधिक datas को handle करने की capablity होती है |इसे use करने से पहले केवल initial करना होगा|इसमें array,pointer,function आते है |
2.Fundamental Types:
ये भी कंप्यूटर मे Pre define data type होते है लेकिन ये एक variable मे केवल एक data value को handle कर सकते है |इसमें int ,char,double,float आदि आते है |
3.User Define Types :
ये user define datatype होते है |इसमें structure,unions ओए enumeration आते है |इस article मे हम array का प्रकारों का अध्धयन करेगे |
Array:
परिभाषाः
अंगेजी मे : Array is fixed size collection of homogeneous(Same data types) datatypes.
हिंदी मे : Array समान datatypes को समूह होता है |
उदहारण के लिए :
किसी week के सात दिनों के Temperature का समूह|
Food store मे किसी food item की Perday sale का समूह आदि |
Array तीन प्रकार की होती है :
One Dimension Array :
One Dimension Array मे,किसी एक data variable मे data किसी एक subscript मे store होता है |ये दो प्रकार की होती है |
1.Row : इसमें Array Values ,Row structure मे store होती है |सभी block का के fixed address होता है |डायग्राम मे दिखया गया है :-
2. Coloum Wise : इसमें array values,coloum structure मे store होती है |सभी memory blocks का fixed address होता है :
Array का syntax है :-
Array datatype variable-name[size];
Array data type: ये बताता है की किस तरह का datas Array मे store होगा |
variable-name : ये array का नाम होता है जिसे data assigning ,data calling मे use किया जाता है |
size: ये declare करती है की कितने memory blocks या datas array मे store हो सकती है |
जिस तरह ,किसी data types को use करने से पहले declare करना पड़ता है ठीक उसी प्रकार से array को use करने से पहले declare करना पड़ता है |
Array initial:
Array को declare करने के बाद initial करना पड़ता है |जब तक array को intailize नहीं किया जाता है जब तक ये garbage value store सकता है |ये दो प्रकार से सकता है:-
1.Compile Time initial:
इस प्रकार मे ,जैसे fundamental data variable को initail करते है |वैसे इसे भी initial करते है |इसका syntax है |
Array datatype variable-name[size]=[data values];
इसका उदहारण है :-
int a[5]-==[2,5,8,7,9];
इस उदहारण मे a एक array है जिसका datatype integer और size 5 है जिसमे address ‘0’ पर 2,address’1′ पर 5,address’2’पर 8 ,address ‘3’ पर 7 और address ‘4’ पर 9 store होता है |
उदहारण 2:
float temperature [7]=[22.7,23.7,27.8,12.4,23.5,23.6,29.8];
इस उदहारण मे array का नाम temperature है जिसका datatype float है ये सात दिनों के temperature को store करता है |
2.Run Time initial:
जब किसी array को run time मे initial किया जाता है tab इस प्रकार के RUN TIME initial कहते है |मुख्य किसी array के run time initial मे for loop का use किया जाता है |ये methodology बहुत बड़ी array को initial करने मे use होती है |
उदाहरणके लिए :
#include<stdio.h>
#include<conio.h>
void main ()
{
int a[10];
int i;
for(i=1;i<=20;i+2)
{
if(i==5)
{
a[i]=10;
printf(“%d\n”,a[i])
}
else
{
a[i]=i;
printf(“%d\n”,a[i])
}
}
इस उदहारण मे जब i की value 5 होगी तब array a की address 5 पर 10 assign होगा और i की बाकि value के लिए i की value assign होगी |
आउटपुट होगा :
1
3
10
7
9
11
13
15
17
19
उदहारण के लिए :
इस उदहारण मे , Average को calculate करने के लिए code है |
#include<conio.h>
#include<stdio.h>
void main ()
{
int a[5];
int sum;
float avg;
printf(“Enter your data\n”);
for(i=0;i<=5;i++)
{
scanf(“%d”,&a[i]);
}
for (i=0;i<=5;i++)
{
sum=sum+a[i];
}
avg=sum/5;
printf(“Average of five values=%1f”,avg);
getch();
}
इस उदाहरण मे ,data को read करने के लिए for loop को use किया गया है |जब i=0 होने पर,a[i]=a[0] पात्र यूजर द्वारा दिए गये data store होता है और i=1 होने पर ,a[i]=a[1] , इसेर द्वारा दिया गया दूसरा data store होता है |ये प्रोसेस होती रहगी जब त्याक i की value 5 नहीं हो जाती है |
आउटपुट होगा :
Enter your data
12 23 34 54 23
Average of five values=29.2
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…
Translation in english grammer in hindi examples Step of Translation (अनुवाद के चरण)
Translation 1. Step of Translation (अनुवाद के चरण) • मूल वाक्य का पता करना और उसकी…
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…
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…
विश्व के महाद्वीप की भौगोलिक विशेषताएँ continents of the world and their countries in hindi features
continents of the world and their countries in hindi features विश्व के महाद्वीप की भौगोलिक…
भारत के वन्य जीव राष्ट्रीय उद्यान list in hin hindi IAS UPSC
भारत के वन्य जीव भारत में जलवायु की दृष्टि से काफी विविधता पाई जाती है,…