What is Array in c
hello and welcome friends aaj mai baat karne wala hu array ke bare me jismen ham janenge ki array kya hai aur yah kitne prkar ka hota hai.array ek derrived data type ka prakar hai aur yah user ke dwara banaya jata hai lekin isko banane ke liye pahle se upasthit primary ya fundamental data type ka upyog kiya jata hai.
Array
array ek hi prakar ke data items ke ek group hote hai. ye data item ek dusre se sambandhit hote hai, in group ko ek hi nam se pahchana jata hai.array ke sabhi data items ek hi memory me ek hi sthan par store kiye jate hai jinhe contiguous Memory Allocation kahte hai.kisi Array ko declare karne ke liey Array name ke bad square bracket me ek value likhte hai jise Array ka size kahte hai.
int n[10]; |
---|
array declaration
- Array ek same data type data item ka group hota hai.
- Array me data item ki position 0 se start hoti hai.
- Array ko use krne ke pahle iska type ewm size Difine krna aavshyak hai.
- array ke sabhi data items memory ke ek hi sthan par store hote hai.jise ek index variable ki sahayta se use kiya jata hai
array ko subscript variable bhi kahte hai.
Types of array
- One dimensional array
- Two dimensional array
- Multi dimensional array
- One dimensional Array:
one dimensional array ko single dimensional array bhi kaha jata hai yah linear list hai.
jisme similar type ke data items ko store kiya jata hai. memory me sabhi data items ek ke bad ek (contiguous memory allocation) store kiye jate hai.
One dimensional Array ke sabhi data items ko acccess krne ya read krne ke liye ek index variable ka upyog kiya jata hai.
Declaration of one dimensional Array:
syntex:-
data type Array name [size] |
is array ko data item ka metrix presentation bhi kahte hai Two dimensional array ka prayog data items ko regular form me (row and column) me arrange krne ke liye kiya jata hai isme kisi vishesh data item ko display karne ke liye do index value ka upayog kiya jata hai. index me first value row ko represent krta hai tatha second value column ko represent krta hai.
Declaration of two dimensional array:
data type Array name [no.of. row][no.of. column] |
Two dimensional array me plus, minus, multiply and Division tabhi sambhav hai jab-
- pahla matrix ka row aur dusre matrix ka same hona chahiye.
- pahle matrix ka column dusre matrix ke column ke brabr hona chahiye.
Click here for example of two dimensional array
Other topic
Post a Comment
Post a Comment