TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: GEORGE WHITE
from: Robin Sheppard
date: 1998-12-24 05:43:00
subject: puts()

GW> Hi Frederic,

 GW> You asked:
 
 FT> If the function prototype for puts() is:
 
 FT>     int puts(const char *s);
 
 FT> how can it print the following parameter:
 
 FT>     puts( "Hello world from puts!" );
 
 FT> which is not the value of a pointer to char?

 GW> In this case it is, as in C anything other than an integral data type
 GW> is passed by reference. So in the puts() call the address of the start
 GW> of the string "Hello world from puts!" is used, which is
a "const char
 GW> *" 

   Nope, it's still passed by value, since the argument the function 
   expects to receive is a pointer, in other words, the value of said 
   pointer.  It's semantics, though I like to be able to say, 
   unequivocally, that C always passes by value.  :)
   
... "It compiled?  The first screen came up?  Ship it!" -Bill Gates
___ Blue Wave/DOS v2.30 [NR]

--- EzyQwk V1.48g0 01fa0167
* Origin: Milky Way, Langley, BC [604] 532-4367 (1:153/307)
SEEN-BY: 396/1 632/0 371 633/260 262 267 270 371 634/397 635/506 728 639/252
SEEN-BY: 670/218
@PATH: 153/307 8086 800 140/1 396/1 633/260 635/506 728 633/267

SOURCE: echomail via fidonet.ozzmosis.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™.