passing glist to func
- From: <revans ozarkaircraftsystems com>
- To: gtk-app-devel-list gnome org
- Subject: passing glist to func
- Date: Mon, 9 Oct 2000 07:54:04 -0500 (CDT)
Please forgive my ignorance, but could someone explain why this doesn't
work? I want to pass a pointer to a glist to a function and modify that
glist there. The following program prints the value of "a" in function foo
then gives a Segmentation fault trying to print the value of "list" in
main.
Thanks
--------------------------
#include <glib.h>
#include <stdio.h>
void foo(GList *a)
{
a=g_list_append(a, "text");
a=g_list_first(a);
printf("a=%s\n", (char *) a->data);
}
int main()
{
GList *list=NULL;
foo(list);
list=g_list_first(list);
printf("list=%s\n", (char *) list->data);
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]