JOIN us on
WhatsApp Group Join Now
Telegram Join Join Now

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

Categories: C Language in hindi

Array : Three Dimensional Array 3D और Address Calculation in hindi in c language 3D अरे इन हिंदी

3D अरे इन हिंदी Array : Three Dimensional Array 3D और Address Calculation in hindi in c language :-
इसके पिछले articles मे हमने one dimension और two dimension array को पढ़ा था |इस article मे multi
dimension arrays और dynamic arrays को
पढेगे |
Multi Dimensional
Array:
Multi dimension
array मे दो से अधिक subscript होती है |जिसमे data store होता है |इसका syntax है
|
data type array
name[ subscript 1 size] [subscript 2 size] [subscript n size];
data type: datatype
को मतलब है इसमें किआ प्रकार का data store होगा |
array name : array
name array का नाम है |
subscript 1 size : subscript
1 की size है जो ये बताता है की subscript 1 मे कितने values store होगी |
उदहारण के लिए :
int school [year][class][Gender];
int ABC [3][12][2];
इस उदहारण मे , int
ABC [3][12][2]; statement से एक array ‘ABC’ बनती है जिसमे तीन वर्षो मे किसी
school मे students की सख्या को class wise और gender wise data store किया गया |
#include<conio.h>
#include<.stdio.h>
Void
main ()
{

 

int array[2][2][2];

 

Printf(“Enter six value ”);
For(i=0;I,2;i++)
{

 

for(j=0;j<2;j++)

 

{
For(k=0;k<2;k++)
{

 

scanf(“%d”,&array[i][j][k]);

 

}

 

}

 

}
For(i=0;I,2;i++)
{

 

for(j=0;j<2;j++)

 

{
For(k=0;k<2;k++)
{

 

printf(“array[%d][%d][%d]=%d\n”i,j,k,array[i][j][k]);

 

}
}
}

 

getch();

 

}
आउटपुट होगा :
Enter eight value 12 23 23 34 5 56 55 12
array[0][0][0]=12
array[0][0]1]=23
array[0][1][0]=23

 

array[0][1][1]=34

 

array[1][0][0]=5
array[1][0][1]=56
array[1][1][0]=55
array[1][1][1]=12
Address Calculation :
C language मे ,किसी array मे किसी element के address को calculate करने के लिए pre set rules है|लेकिन ये rules array के तीनो  types के लिए अलग -अलग है |
One Dimension Array:
इसका फार्मूला है :- location[array[element index]]=base address+(index-1).
Base address: इसका मतलब है first array element का address |
index: जिस element का address calculate करना है उसका index|
उदहारण के लिए :
अगर किसी array का base value 200 है और उस array के fifth index पर स्थित element का address calculate करना है तब
address[array[5]]=200+(5-1);
                         =200+4
                         =204
Two Dimension Array :
Two dimension array मे memory allocation दो प्रकार के होते है उसके आधार पर दो फार्मूला होते है |
Row Wise के लिए:
Location ( A[ i,j ] ) =Base Address + ( N x ( I – 1 ) ) + ( j – 1 )
यहा पर ,
N : coloum Size
I : Element की Row index
J: Element की column index
उदहारण के लिए , एक two dimension array array[300][250] का base address 200 होती है | तब array[45,34] का address calculate करे |
location(array[45,34])=200+(250*(45-1)+(34-1))
                                 =200+(250*44+33)
                                 =11233
column wise के लिए
Location ( A[ i,j ] ) =Base Address + ( M x ( j – 1 ) ) + ( i – 1 )
यहा पर ,
N : Row Size
I : Element की Row index
J: Element की column index
उदहारण के लिए , एक two dimension array array[300][250] का base address 200 होती है | तब array[45,34] का address calculate करे |
location(array[45,34])=200+(300*(45-1)+(34-1))
                                 =200+(300*44+33)
                                 =13433
Three Dimension Array:
इसमें भी address के लिए two प्रकार के फार्मूला यूज़ हो सकते है |
अगर array का memory allocation row wise है तब,
Location ( X[i,j,k] )=BA + MN (k-1) + N (i-1) + (j-1)
और
अगर array का memory allocation column wise है तब,
Location ( X[i,j,k] )=BA + MN (k-1) + M (j-1) + (i-1)
उदहारण के लिए , एक two dimension array array[300][250][100] का base address 200 होती है | तब array[45,34,32] का address calculate करे |
अगर row wise allocation होगा तब
location(array[45,34])=200+(300*250(32-1)+250(45-1)+(34-1))
                                 =200+(75000*31+11000+33)
                                 =2336233
Array के उपयोग:
Array का मुख्य काम होता है Matrix Form मे data को store करना |लेकिन इसके अलावा array कई दुसरे data type को बनाने मे use होता है |
1.Hash Table
इसमें data हमेशा table मे store होता है use hash tabel कहते है इसके दो parts होते है (i) keys (ii)values.key मे array के address store होता है और values मे array के elements|
2.Queues
Queues एक FIFO (first come first out) based data type है |जिसमे जो data  सबसे पहले insert होता  है वो सबसे पहले बाहर निकलता है |जैसे ticket window पर train passenger की Queue|
3.Stack
Stack एक LIFO (Last come first out) based data type है |जिसमे जो data  सबसे बाद मे  insert होता  है वो सबसे पहले निकलता है |
4.Dequeues
इसका पूरा नाम double ended queue है |इसमें  दोनों तरह से data को डिलीट कर सकते है |
5.String
Array का सबसे महत्त्वपूर्ण उपयोग String बनाने होते है |इसका detail मे हम String article मे पड़ेगे|
इस तरह array कई और data type को बनने के अलावा dynamic memory allocation मे use होता है |जिसे हम next article मे detail मे पड़ेगे |
Sbistudy

Recent Posts

सती रासो किसकी रचना है , sati raso ke rachnakar kaun hai in hindi , सती रासो के लेखक कौन है

सती रासो के लेखक कौन है सती रासो किसकी रचना है , sati raso ke…

18 hours ago

मारवाड़ रा परगना री विगत किसकी रचना है , marwar ra pargana ri vigat ke lekhak kaun the

marwar ra pargana ri vigat ke lekhak kaun the मारवाड़ रा परगना री विगत किसकी…

18 hours ago

राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए sources of rajasthan history in hindi

sources of rajasthan history in hindi राजस्थान के इतिहास के पुरातात्विक स्रोतों की विवेचना कीजिए…

2 days ago

गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है ? gurjaratra pradesh in rajasthan in hindi

gurjaratra pradesh in rajasthan in hindi गुर्जरात्रा प्रदेश राजस्थान कौनसा है , किसे कहते है…

2 days ago

Weston Standard Cell in hindi वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन

वेस्टन मानक सेल क्या है इससे सेल विभव (वि.वा.बल) का मापन Weston Standard Cell in…

3 months ago

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 ,…

3 months 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