5

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 1

7
  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?
2
  • 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
    Mar 22, 2010 at 12:08
  • 1
    You're welcome. Maybe you should use a tree for that, otherwise how will you give different operators different priorities?
    – ptomato
    Mar 22, 2010 at 13:17

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.