call by reference

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jamihuq

    #1

    call by reference

    Hello all,
    I have a question. Does the concept of call by reference exist in C
    like it does in C++? And if so, can someone give me an example.

    Thanks
    Jami

  • roberts.noah@gmail.com

    #2
    Re: call by reference


    jamihuq wrote:[color=blue]
    > Hello all,
    > I have a question. Does the concept of call by reference exist in C
    > like it does in C++? And if so, can someone give me an example.[/color]

    You use pointers. Caller has to know and provide the appropriate data.

    Comment

    • Bilgehan.Balban@gmail.com

      #3
      Re: call by reference

      jamihuq wrote:[color=blue]
      > Hello all,
      > I have a question. Does the concept of call by reference exist in C
      > like it does in C++? And if so, can someone give me an example.
      >
      > Thanks
      > Jami[/color]

      Hi,

      It works the same way, i.e. you pass an `int' by value, but there are
      no references in C. So you must pass a pointer to an int, in order to
      have call by reference.

      Bahadir

      Comment

      • Alf P. Steinbach

        #4
        Re: call by reference

        * jamihuq:[color=blue]
        >
        > I have a question. Does the concept of call by reference exist in C
        > like it does in C++? And if so, can someone give me an example.[/color]

        The concept exists independent of language.

        The language support for the concept differs depending on the language.

        Since C is mostly a subset of C++, the support present in C (namely,
        pointers) is also present in C++, and in addition C++ has a dedicated
        reference type.

        --
        A: Because it messes up the order in which people normally read text.
        Q: Why is it such a bad thing?
        A: Top-posting.
        Q: What is the most annoying thing on usenet and in e-mail?

        Comment

        Working...