Re: Off Topic - C pointer problems
- From: Ronald Bultje <rbultje ronald bitfreak net>
- To: rhfreeman <rhfreeman micron com>
- Cc: gtk-list gnome org
- Subject: Re: Off Topic - C pointer problems
- Date: Thu, 19 Jul 2001 14:40:39 +0200
At 06:34 19-07-2001 -0600, you wrote:
struct clist_holder {
otherstruct **sd;
int *mid;
}
clist_holder->sd[0]=....;
Unallocated pointer.
Read about it in any C book.
or do:
int num = ....; /* put here the number of items you want in this array */
clist_holder->sd = (otherstruct**)malloc(sizeof(otherstruct*) * num);
clist_holder->sd[0] = ....;
Don't forget to free() it when you no longer need it.
Ronald
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]