I want to convert an integer value to string in GLib. Is there any macro or function to da that? Or Can i store different data types in the same doubly linked list?
1 Answer
gchar *my_string = g_strdup_printf("%i", my_integer);
- Yes, you can store any pointer you want, or even an integer using
GINT_TO_POINTER
, but how will you know what data type to get back out?
-
1.Thanx a lot for ur answer... 2.I am actually storing an expression in a doubly linked list. So all odd nodes (starting from 0) will be operators and even nodes the operands.– AshwinMar 22, 2010 at 12:08
-
1You're welcome. Maybe you should use a tree for that, otherwise how will you give different operators different priorities?– ptomatoMar 22, 2010 at 13:17