Is this ok??

Art Neilson art at pilikia.pegasus.com
Sat Mar 9 19:26:11 AEST 1991


In article <DAVIS.91Mar6213546 at pacific.mps.ohio-state.edu> davis at pacific.mps.ohio-state.edu  (John E. Davis) writes:
>Hi,
>
>   The following code works on sun4 and ultrix but crashes on VMS.  Just when
>I thought I understood pointers.....

After seeing lots of replies to John Davis I went back and examined the
program he posted again and realized I was wrong regarding his pointer
usage, I sorta jumped the gun when I saw the &'s and ** stuff, I was
wrong. I still don't think it's OK to assign the quoted string "Hello\n"
to *s in fm2() as shown below.  Where does *s point to ?  Where in storage
would "Hello\n" reside ?  Does the compiler assign some scratch storage or 
something for it ??

>#include <stdio.h>
>void fm2(s)
>char **s;
>{
>    *s = "Hello\n";
>}
-- 
Arthur W. Neilson III		| INET: art at pilikia.pegasus.com
Bank of Hawaii Tech Support	| UUCP: uunet!ucsd!nosc!pilikia!art



More information about the Comp.lang.c mailing list