Re: why???
- From: "John Cupitt" <jcupitt gmail com>
- To: dagang001 <tj_jzg 163 com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: why???
- Date: Fri, 8 Sep 2006 15:44:25 +0100
Hi,
On 9/8/06, dagang001 <tj_jzg 163 com> wrote:
for ( i=0 ;i<4 ;i++)
{
fred->name = ming[i];
fred->shoe_size = i+10;
fred->age=60+i;
list = g_list_append(list, fred);
}
You need to make a new Person each time. At the moment you are making
a single Person, adding a pointer to it to the list, and overwriting
the details next time around the loop.
You'll need to change the way you free the list too.
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]