Sunday, July 26, 2009

What are the 2-Dimensional Arrays in C Language??

Also Tell me About where to download a Free tutorial for C Program


Especially for Beginners





Very Urgent Plz???

What are the 2-Dimensional Arrays in C Language??
ok arrays are basicallty used to store data of same type , the type can be integher float or double etc





in single dimension array the elements are stord linearly in memory.





eg


elements 10 20 30 40





address 3000 3002 3004 3008





in case of 2 dimensional array ther is some thing called a matrix conatining row and column





here each element is identified by 2 indices (i and j)as opposed to a single index in case of 1-dimensional array(i)





here arr[i][j] indicates elemnt in i th row and j th column





so its 2 dimensional





and consider eg





arrray[2][2]={


1 , 2


3 , 4 }





its stored in memory as





elemnt 1 2 3 4








address 3000 3002 3004 3006








for more read yesvant kanetkar book ":let us c"





since ur a beginner








to actaully get material visit www.esnips.com





u ill get all e books from basic to high level


enjoy
Reply:A two dimension array is stored as RowMajor or ColumnMajor Order as in Single dimension array.
Reply:declare


dt[d1size][d2size] varname;(


or dt[d1size][d2size] varname = {


{},


...,


{}


})


(dt: data type of the array


d1size: size of the 1st dimension


d2size: size of the 2nd dimension


varname: variable name


{


{},


...,


{}


} IS a form of initialization, understand it through this simple ex:


int[2][3] ia = {


{1, 2, 3},


{2, 3, 4}


} IS an array with 2 rows, 3 columns)


use


write: varname[rowindex][columnindex] = value;


(varname is as above


rowindex IS row index WHICH IS rowth - 1, ex 1st row has the row index 0, 2nd row has the row index 1


columnindex IS column index WHICH FOLLOWS a similar rule as the row index


value IS the value written)


read: dt anothervarname = varname[rowindex][columnindex];


(dt IS a data type WHICH IS the same as the data type of varname variable


anothervarname IS another variable WHICH IS different from varname variable


varname, rowindex, columnindex ARE the same)





refer these links (they are not downloadable but they hold just 1 html webpage which can be saved by File-Save As...)


http://einstein.drexel.edu/courses/CompP...


http://www.lysator.liu.se/c/bwk-tutor.ht...


http://www.iu.hio.no/~mark/CTutorial/CTu...


http://www.le.ac.uk/cc/tutorials/c/


http://visualcplus.blogspot.com/


// quiz


http://kdat.csc.calpoly.edu/~ltauck/THES...
Reply:array is(math)


a11 a12 a13


a21 a22 a23


a31 a32 a33


now in computer aij; 0%26lt;=i,j%26lt;=2


a00 a01 a02 a10 a11 a12 a20 a12 a22


No comments:

Post a Comment