I have a GArray of GValue (all non-zero) which has been allocated at runtime with g_array_append_val. I wonder how can I find out what's the index of the last element, or more precisely how many elements does the array hold. Code like
for (length=0;g_value_get_int(&g_array_index(array, GValue, length)); length++);
return length
would fail with an out of bounds.