English 中文(简体)
Pascal按价值分列的呼吁
原标题:call by value-result in Pascal

如何以这种榜样的价值推敲。 如果不增加变量,也不会改变一个变数名称?

Program one;
    var
      x:integer;
    Function two():integer;
        begin
           x:=x+1;
           two:=x;
        end;
    Procedure three(x:integer);
       begin
          x:=x+5;
          x:=two();
       end;
begin
x:=8;
three(x);
write(x);
end.
问题回答

如果做家务,我不认为你必须尝试var<>em>。 很难找到答案。

EDIT:以下评论是正确的——也许在我带领你走错的道路——这很可能是回到我们在那里和从那里开始的地方。

三个(a)已经做了些什么。

很难以目前的形式提出这个问题。

然而,如果我们认为,《任择议定书》(is)要求如何在《示范法》中加入by reference(不是按价值计算)的话,问题似乎有些意义。

因此 实际代码将参数按数值载到3(>>>>>。 3()>似乎试图将这一数值储存到全球变量上,然后再打上2(<><>>>>>>>>/code>,进而改变全球。

但是,全球变量实际上正在被用来传递这一价值,因此,trick计是,在通过全球by Value3(<>>>>>后,全球将随着参考而变化。

只有一个小问题(似乎构成整个问题):如何从<条码>3(<>>>>>>/代码”中解决全球问题,因为参数名称与全球数值相同?

我不知道帕斯卡尔的哪一个版本本应适用这一法典,但如果汇编者与TP/Delphi一家相容,如果姓氏必须保持不变,那么我将尝试迄今为止我所知的唯一方式:。 具体来说,这一行文载于 3(>)

x:=x+5;

我会改变立场。

one.x:=x+5;

因此,此处的全球接收参数值增加了5,电话:2(>)和2(>再次改变全球。





相关问题
Mutually exclusive powershell parameters

SCENARIO I m writing a cmdlet for Powershell 2.0 using Visual Studio 2008 and .NET 3.5 the cmdlet requires 3 arguments. my intended grammar of the cmdlet is something like this: cmdletname [foo|...

Elegant way building url request with parameters

There must me a more elegant way to build a URL with parameters in .NET then for example Response.Write("<a href=HeadOfMarketView.aspx"+Session["HOM"] != null ? Session["HOM"]+">Head of Market&...

Can you pass by reference in Java?

Sorry if this sounds like a newbie question, but the other day a Java developer mentioned about passing a paramter by reference (by which it was ment just pass a Reference object) From a C# ...

How to name a method that has an out parameter?

What is the common preference to name a method that has an out parameter inside? Usually I use Get as a prefix to mention that the method returns a value (like GetMyBusiness). But what if there is ...

How to create program startup parameters in python

I m just beginning to learn python and the program I m writing requires parameters for it to run with a specific task. For example (programs name is Samtho) samtho -i Mozilla_Firefox How can I do ...

Weird behaviour of h:commandLink action (MethodExpression)

I have two JSPs where I am displaying some info from database in a h:dataTable. One of them is showing all the info, and one of them user specifically. I have showXML.jsp that shows the "XML" column ...

using parameter in SQL with LIKE keyword

from my C#-programm, I access a SQL Server 2008 Database. I have a table with a fulltextindex and want to search for an indexed entry: SELECT page_id FROM page_categories WHERE page_title LIKE @title ...

采用网路服务方法

我撰写了一个网络服务,期望一个参数(所谓的“hlink”)成为一种ur。 在使用网络服务之前,URLEncode 所涉参数(“hlink”)。 然后我打电话......。