Inc(I)   是什么意思?

解决方案 »

  1.   

    procedure Inc(var X [ ; N: Longint ] );DescriptionIn Delphi code, Inc adds one or N to the variable X.X is a variable of an ordinal type (including Int64), or a pointer type if the extended syntax is enabled.N is an integer-type expression. X increments by 1, or by N if N is specified; that is, Inc(X) corresponds to the statement X := X + 1, and Inc(X, N) corresponds to the statement X := X + N. However, Inc generates optimized code and is especially useful in tight loops.Note: If X is a pointer type, it increments X by N times the size of the type pointed to. Thus, giventype  PMytype = ^TMyType;andvar  P: PMyType;the statementInc(P);increments P by SizeOf(TMyType).Warning: You can抰 use Inc on properties because it modifies the parameter.Note: Inc(S, I) where S is a ShortInt and I is a number greater than 127 will cause an EIntOverFlow exception to be raised if range and overflow checking are on. In Delphi 1.0, this did not raise an exception.
      

  2.   

    呵呵, 上面的shanliang的人回复了
      

  3.   

    Inc()        ++
    Dec()        --可以传递一个或两个参数
    Inc(variable,N);   (N表示递增或递减值的大小)
      

  4.   

    这是 boytomato(深爱一人叫颖的女孩!) 的贴,我翻译一下,翻译不好别怨我procedure Inc(var X [ ; N: Longint ] );描述在Delphi代码中, Inc 使变量x加一或n.X 是一个顺序型变量(包括Int64型), 在扩展语法中也可以是指针类型
    N 是一个整型表达式. X 增加1,如果指定了n就增加n; 也就是说, Inc(X) 相当于语句X := X + 1, 并且 Inc(X, N) 也相当于语句X := X + N.但是, Inc 优化了代码,执行效率更高.注意:如果X是指针类型, 他将增加X所指的数据的N倍大小. 因此:type  PMytype = ^TMyType;andvar  P: PMyType;the statementInc(P);increments P by SizeOf(TMyType).警告: 你可以在属性中用此函数因为他可以修改参数.注意: Inc(S, I) 中如果S超出了他的最大值,将要引起错误
      

  5.   

    inc(i)  --->i:=i+1;
    inc(i,3)--->i:=i+3;
    dec(i)  --->i:=i-1;
    dec(i,3)--->i:=i-3;
    OK!
      

  6.   

    真可爱啊,我很善良!
    既然你问了,我就大发善心的告诉你啦!
    INC(i)就是C中的 i++;