Thread: o/p of call by reference needed!

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    1

    o/p of call by reference needed!

    I need the o/p of foll code in terms of call by reference.Plz ignore the small programmin errors as this a pseudo code not a runninf code

    Code:
    value(x,y,z)
    {
      x=x*y;
      x=x+y+z;
    }
    
    main()
    {
     a=3;
     value(a,2*a,a);
     printf("value of a,a);
    }
    the value function will hold after refernce (27,6,3)
    In this case which value of a does it print??
    plzz help me

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Turn it into runnable code, then find out the answer for yourself. It is a better learning experience that way.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by chocoboy308 View Post
    Plz ignore the small programmin errors as this a pseudo code not a runninf code
    This small "programmin errors" make it impossible to understand your question.
    Kurt

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inline asm
    By brietje698 in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2007, 02:54 PM
  2. Using call by reference in this program
    By BurleMD in forum C Programming
    Replies: 3
    Last Post: 10-28-2006, 12:23 PM
  3. Assembly example
    By Lynux-Penguin in forum C Programming
    Replies: 6
    Last Post: 04-24-2002, 07:45 PM
  4. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 09:51 AM
  5. Help needed with external call, WinExec() and timer.
    By algorithm in forum Windows Programming
    Replies: 9
    Last Post: 11-07-2001, 09:35 AM