o/p of call by reference needed!

Discussion in 'C' started by chocoboy308, Nov 17, 2007.

  1. chocoboy308

    chocoboy308 New Member

    Joined:
    Nov 17, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Guys I need the o/p of the foll pseudo code in terms if call by reference.Plz ignore the small programmin errors as this a pseudo code not a running code

    Code:
    SUM(x,y,z)
    {
    x=y*x;
    z=z+x;
    }
    
    main()
    {
    a=3;
    b=7;
    SUM(b,b-a,a)
    printf(a,b,b-a);
    }
    
    here a=31,b=28,but what will be the value of b-a will it be 4 which we get after computing the sum function or will it be -3 from the new values of and b(i.e 28-31)



    2)

    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
     
    Last edited by a moderator: Nov 17, 2007
  2. chocoboy308

    chocoboy308 New Member

    Joined:
    Nov 17, 2007
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    plz somebody help me in this matter!!
     
  3. Salem

    Salem New Member

    Joined:
    Nov 15, 2007
    Messages:
    133
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Please don't PM me for 1:1 support.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice