Thursday, July 30, 2009

How to know the Rows n Cols in a 2D Integer Array in C ??

int Array[3][5];


this is an array with 3 rows of 5 integers in each row


example:


Array[0] = 1,2,3,4,5


Array[1] = 5,4,3,2,1


Array[2] = 2,1,4,3,5

How to know the Rows n Cols in a 2D Integer Array in C ??
Determining the size of an array can be tricky. The number of elements can be found using something like:


sizeof array / sizeof array[0]


No comments:

Post a Comment