int b[2][2] =
{
{4,6},
{-3,0}
};
int b_length = (sizeof b)/sizeof(int);
int *sub_b = b[1];
b_length will have the length of 2-D array b (4, in this case).
now sub_b is the sub-array of b at row 1, which is {-3,0}
Is there any way to find the length of sub_b other than the below technique.
You'll have a problem if you pass it to a function as some kind of pointer
Yes, exactly. That's the same issue i faced when I tried sizeof on sub_b pointer.
My question is, whether there is anyway I could get the size of the sub-array of "b".
For example in Java I can do something like this
int[] sub_b = b[1];
sub_b.length; //gives me the size of the sub-array