tags:

views:

95

answers:

1

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: 
  1. gchar *my_string = g_strdup_printf("%i", my_integer);
  2. 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
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
You're welcome. Maybe you should use a tree for that, otherwise how will you give different operators different priorities?
ptomato