Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #43957

Re: pass by address

From "Bill Cunningham" <nosapm@nspam.invalid>
Newsgroups comp.lang.c
Subject Re: pass by address
Date 2014-05-03 01:54 -0400
Organization A noiseless patient Spider
Message-ID <lk20a0$9bs$1@dont-email.me> (permalink)
References <lk10j7$uhr$1@dont-email.me> <e1b8m9ts8r0etmrn2te17g36k19rsra2hp@4ax.com>

Show all headers | View raw


"Barry Schwarz" <schwarzb@dqel.com> wrote in message 
news:e1b8m9ts8r0etmrn2te17g36k19rsra2hp@4ax.com...
> On Fri, 2 May 2014 16:53:01 -0400, "Bill Cunningham"
> <nosapm@nspam.invalid> 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
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.

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-02 16:53 -0400
  Re: pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-02 17:03 -0400
    Re: pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-02 17:20 -0400
  Re: pass by address Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2014-05-02 17:58 -0400
    Re: pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-02 18:09 -0400
      Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-02 16:37 -0700
        Re: pass by address gazelle@shell.xmission.com (Kenny McCormack) - 2014-05-02 23:43 +0000
          Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-03 15:58 +0200
            Re: pass by address gazelle@shell.xmission.com (Kenny McCormack) - 2014-05-03 14:08 +0000
              Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-03 10:38 -0700
                Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-03 21:13 +0200
        Re: pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-03 01:46 -0400
        Re: pass by address "Bill Cunningaham" <nospam@nspam.invalid> - 2014-05-03 11:22 -0400
          Re: pass by address James Kuyper <jameskuyper@verizon.net> - 2014-05-03 12:13 -0400
          Re: pass by address Keith Thompson <kst-u@mib.org> - 2014-05-03 12:34 -0700
            Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-03 22:33 +0200
            Re: pass by address glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2014-05-03 21:21 +0000
              Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-04 00:08 -0400
                Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-03 21:52 -0700
                Re: pass by address Tonton Th <tth@nowhere.invalid> - 2014-05-04 08:44 +0000
                Re: pass by address Keith Thompson <kst-u@mib.org> - 2014-05-04 01:51 -0700
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-04 15:06 -0400
                Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-04 15:35 -0700
                Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-05 12:01 +0200
                Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-05 11:46 -0700
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-05 14:18 -0400
                Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-05 11:55 -0700
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-05 15:20 -0400
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-05 15:23 -0400
                Re: pass by address Ken Brody <kenbrody@spamcop.net> - 2014-05-06 11:02 -0400
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-06 14:46 -0400
                Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-05 12:00 +0200
                Re: pass by address Malcolm McLean <malcolm.mclean5@btinternet.com> - 2014-05-05 14:50 -0700
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-05 23:13 -0400
                Re: pass by address "Osmium" <r124c4u102@comcast.net> - 2014-05-05 23:09 -0500
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-06 08:55 -0400
                Re: pass by address Ken Brody <kenbrody@spamcop.net> - 2014-05-06 11:16 -0400
                Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-06 18:13 +0200
                Re: pass by address Kaz Kylheku <kaz@kylheku.com> - 2014-05-04 21:06 +0000
                Re: pass by address Kaz Kylheku <kaz@kylheku.com> - 2014-05-04 23:50 +0000
                Re: pass by address Keith Thompson <kst-u@mib.org> - 2014-05-04 12:36 -0700
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-05 14:21 -0400
                Re: pass by address Keith Thompson <kst-u@mib.org> - 2014-05-04 01:29 -0700
                Re: pass by address "Bill Cunningham" <nospam@nspam.invalid> - 2014-05-04 15:09 -0400
        Re: pass by address "Bill Cunningaham" <nospam@nspam.invalid> - 2014-05-03 11:32 -0400
  Re: pass by address Barry Schwarz <schwarzb@dqel.com> - 2014-05-02 16:43 -0700
    Re: pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-03 01:54 -0400
      Re: pass by address Richard <rgrdev_@gmail.com> - 2014-05-03 15:59 +0200
    Re: pass by address "Bill Cunningham" <nosapm@nspam.invalid> - 2014-05-03 02:08 -0400
      Re: pass by address "Bill Cunningaham" <nospam@nspam.invalid> - 2014-05-03 11:46 -0400
    Re: pass by address Kaz Kylheku <kaz@kylheku.com> - 2014-05-03 21:43 +0000

csiph-web