Re: GList
- From: Peter Bloomfield <peterbloomfield bellsouth net>
- To: denis chuvashia ru
- Cc: GTK-app-devel <gtk-app-devel-list gnome org>
- Subject: Re: GList
- Date: Tue, 03 May 2005 13:31:13 +0000
On 05/02/2005 01:13:49 PM, ÐÐÑÐÐÐÐÑÐÐ ÐÐÐÐÑ wrote:
i think that the result of next code must be 3.
but i have 0
...because l is still NULL, and g_list_length(NULL) is 0.
g_list_append returns the address of the first item in the list
with its appended item, so you should use:
if uncomment "l=..." it's work correctly
#include <glib.h>
int main()
{
GList* l=NULL;
// l=g_list_alloc();
l = g_list_append(l,GINT_TO_POINTER(1));
l = g_list_append(l,GINT_TO_POINTER(1));
l = g_list_append(l,GINT_TO_POINTER(1));
printf("%i",g_list_length(l));
}
- References:
- GList
- From: =?koi8-r?Q?=E7=CF=D2=CF=C4=CE=C9=DE=C5=D7_?= =?koi8-r?Q?=E4=C5=CE=C9=D3?=
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]