Re: Off Topic - C pointer problems



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]