[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Modifying element of GArray



> > 	Now, I'm packing these structs into a GArray, but how can I modify
> > value of GArray at a specified index? 
> 
> Use the g_array_index macro. In your example:
> 
> KGrade *pgrade = g_array_index(grade_array, KGrade, index);
> 
Thanks!
> I think the example in the docs is wrong; there is an & before g_array_index
> that should not be there.
> 

Well, I looked at the GArray src, and I think you're right:

	#define g_array_index(a,t,i)      (((t*) (a)->data) [(i)])

	return value is casted to a pointer of xxx type (t*).


-- 
"This is it... This is where I belong..."





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]