TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: Bob van der Poel 76510,2203 (X)
from: Pete Lyall 76703,4230
date: 1992-07-03 00:20:57
subject: #15751-Pointer help

 #: 15754 S12/OS9/68000 (OSK)
    03-Jul-92  00:20:57
Sb: #15751-Pointer help
Fm: Pete Lyall 76703,4230
To: Bob van der Poel 76510,2203 (X)

Bob -

If you're looking to allocate a dynamically sized array, then you pretty much
MUST use malloc() (or a variation).

Example:

   Allocate an array of pointers to type int. The array will be 'num_required'
   long:

  num_required = 49;    /* or whatever */

  .....

  int *array_ptr;       /* pointer to a type of int */
  array_ptr = malloc(num_required * (sizeof (int *)));


You now have an array of pointers to int that may be accessed either in the
form array_ptr[0...num_required-1]  or array_ptr+0...num_required-1.

Pete

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.