TIP: Click on subject to list as thread! ANSI
echo: cis.languages
to: Jim Peasley 72726,1153 (X)
from: Pete Lyall 76703,4230
date: 1990-12-03 08:53:21
subject: #8553-#`C` problem

#: 8568 S3/Languages
    03-Dec-90  08:53:21
Sb: #8553-#'C' problem
Fm: Pete Lyall 76703,4230
To: Jim Peasley 72726,1153 (X)

Jim -

If you're passing the NAME of the array, then that's automatically a pointer to
the array:

 saying: assuming: char myarray[81];

saying  : myarray      is the same as &myarray[0]

So, if you called a function with 'myarray like so:

  do_it(myarray);

You'd need to declare it at the receiving end like this:

  do_it(stuff)
  char *stuff;         /* myarray arrived as a pointer to the base of itself*/
       {
       char woof[3];

       strncpy(woof,myarray+5, 2);  /* grab chars 6 & 7 */
       ....
       }

Pete

There is 1 Reply.

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™.