Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

What's the difference between static and dynamic scoping in this exercise?

pseudocode

  • Please log in to reply
1 reply to this topic

#1 crodriguez08

crodriguez08

    CC Lurker

  • Just Joined
  • Pip
  • 1 posts

Posted 04 March 2012 - 08:23 PM

Hey, I get confused when dealing with the static scope and dynamic scope, and for this pseudocode I have to find both. For both I believe it should print out: 9 4 2 3 however, I'm not entirely sure. Any help would be appreciated, thanks.

Procedure main
g:integer

procedure B(a : integer)
    x:integer

procedure A(n:integer)
    g:=n

procedure R(m:integer)
    write_integer(x)
    x/:=2—integer division
    if x>1
        R(m + 1)
    else
        A(m)
    --body of B
    x:=a X a
    R(1)
--body of main
B(3)
write_integer(g)

  • 0

#2 WingedPanther73

WingedPanther73

    A spammer's worst nightmare

  • Moderator
  • 17757 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 05 March 2012 - 08:45 AM

Start by describing the difference between the two scoping rules.
  • 0

Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

My MineCraft server site: http://banishedwings.enjin.com/






Also tagged with one or more of these keywords: pseudocode

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download