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?
+2
A:
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?
ptomato
2010-03-21 16:14:50
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.
Ashwin
2010-03-22 12:08:53
You're welcome. Maybe you should use a tree for that, otherwise how will you give different operators different priorities?
ptomato
2010-03-22 13:17:15