Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!mit.eternal-september.org!.POSTED!not-for-mail From: Richard Newsgroups: comp.lang.c Subject: Re: pass by address Date: Sat, 03 May 2014 15:59:41 +0200 Organization: http://www.ieee.org/ Lines: 57 Message-ID: <8738grhsj6.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mit.eternal-september.org; posting-host="30bb5ad9361424c1a1fd2d9061949084"; logging-data="12297"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Ym99JRsuLqpQjMwBnjSWiGPo+a/tOdgI=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:NEh7cqCdjH5olXKplNSLKGRlqXo= sha1:NhIx2hHfF4oZh5+o6tYTuQIT6xM= Xref: csiph.com comp.lang.c:43963 "Bill Cunningham" writes: > "Barry Schwarz" wrote in message > news:e1b8m9ts8r0etmrn2te17g36k19rsra2hp@4ax.com... >> On Fri, 2 May 2014 16:53:01 -0400, "Bill Cunningham" >> wrote: >> >>> Now there is something new I've never heard of til now from reading a >>> C >>>book called "pass by address". Now am I understanding it right. I will use >>>this example. >> >> Throw the book away. It is just confusing you. >>> >>>I think scanf might be like this. The second parameter by wanting a >>>pointer >>>is usually passed the address of the pointee using the ampersand (In know >>>there's an elipsis there). But a value is decalred and initialized. Their >>>is >>>no pointer addresss involved. Is that "pass by address"? >> >> Pass by address means whatever you and the author of the book intend >> it to mean. While it is true that there is no pointer OBJECT in this >> code sample, there is a pointer VALUE being passed. The type of the >> expression &n is pointer to int. >> >>> >>> int a=15; >>> scanf("%d\n",&n); >>> >>>See no pointer address. But a pointee address is passed. The /value/ is >>>15. >> >> What do you mean by the phrase "no pointer address"? &n is an address >> of type pointer to int. > > Right but a *pointee's *address is passed. The a which in memory is an > int. Barry you are making things more confusing than they need to be. I > posted this to clear things up. > > int a; //address of type in hold's value of 15 a variable. > int *p; //pointer's address LOL! Genius. So wrong it can ONLY be a troll! > p=&a; //pointer's address contain's address of location in memory where > value is stored. > > printf("%d",*p); // passed to printf value at address pointed to by p. > > Does that make sense? This is the way I'm understanding it. > -- "Avoid hyperbole at all costs, its the most destructive argument on the planet" - Mark McIntyre in comp.lang.c