RIGHT:[[▲>../]]

#contents

*D [#od79b353]

外側の変数にアクセスできるところがポイント。

#code(d){{
#geshi(d){{
void main(char [][] argv)
{
  int foo;
  
  void bar(int xyzzy)
  {
    foo += xyzzy;
  }

  foo = 10;
  printf("%d\n", foo);
  
  bar(1000);
  printf("%d\n", foo);
}
}}

出力例
 10
 1010
*Delphi [#c2abf81f]

Delphiも外側の変数にアクセス可能。

#code(delphi){{
#geshi(delphi){{
program main;

{$APPTYPE CONSOLE}
procedure Foo;
var
  Bar: Integer;

  procedure Xyzzy(value: Integer);
  begin
    Inc(Bar, value);
  end;
begin
  Bar := 10;
  Writeln(Bar);
  
  Xyzzy(1000);
  Writeln(Bar);
end;

begin
  Foo;
end.
}}

出力例
 10
 1010


----

#comment

TIME:"2009-11-28 (Sat) 17:30:28" REFERER:"http://tobysoft.net/wiki/index.php?cmd=replaceplugin" USER_AGENT:"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30729; OfficeLiveConnector.1.4; OfficeLivePatch.1.3)"
Front page   Edit Diff Backup Upload Copy Rename Reload   New Pages Search Recent changes   Help   RSS of recent changes