I have the following two dimensional array:
#define ROW 100
#define LINE 50
int a[ROW][LINE];
but how to get the sizeof array for the last 45 rows, for example a[55][0] to a[99][99]?
can we do something like sizeof(&a[55])?
sizeof of an array is guaranteed to be equal to the sizeof of a single element multiplied by the number of elements. So, if you want to know how much memory is occupied by a specific number of rows, just calculate the number of elements and multiply by element size. 45 rows would require
45 * LINE * sizeof a[0][0]
Or, alternatively
45 * sizeof a[0]
It doesn't really matter whether these are last 45 rows. All rows are the same.
If you want just the last lines, from line 55 and forward, how about
(ROW - 55) * LINE * sizeof(int)
If you just want a generic N number of lines, then how about
N * LINE * sizeof(int)
sizeof operators. That's why I usually always use the variant with parentheses.sizeof expr or sizeof ( type-name ). The expr can be a parenthesized expression. It's the same in C89/C90, C99, and C11.sizeof to expressions (specifically object names), not to types, and I usually don't add parentheses unless it's necessary. Parentheses make it look too much like a function call, when in fact it's a unary operator. But as with most style questions, there's no One True Way.
a[55][0]toa[ROW - 1][LINE - 1].