内容简介:翻译自:https://stackoverflow.com/questions/12958858/why-can-i-not-use-setlength-in-a-function-which-receives-an-array-parameter
我试图使用以下函数来设置动态数组的长度,这是一个var param.
我尝试编译代码时只有一个错误:
[dcc64错误] lolcode.dpr(138):E2008不兼容的类型
function execute(var command : array of string) : Boolean; begin // Do something SetLength(command,0); end;
定义类型
type TStringArray = array of string;
你可以做到
function Execute(var StringArray: TStringArray): boolean; begin // Do something SetLength(StringArray, 0); end;
翻译自:https://stackoverflow.com/questions/12958858/why-can-i-not-use-setlength-in-a-function-which-receives-an-array-parameter
以上所述就是小编给大家介绍的《delphi – 为什么我不能在接收数组参数的函数中使用SetLength?》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- 函数式编程之数组的函数式编程
- 巧用 PHP 数组函数
- C函数中返回字符数组
- javascript数组常用函数与实战总结
- c# – 数组的GetUpperBound()和GetLowerBound()函数
- python – 如何从numpy数组中确定什么是概率分布函数?
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Beginning XML with DOM and Ajax
Sas Jacobs / Apress / 2006-06-05 / USD 39.99
Don't waste time on 1,000-page tomes full of syntax; this book is all you need to get ahead in XML development. Renowned web developer Sas Jacobs presents an essential guide to XML. Beginning XML with......一起来看看 《Beginning XML with DOM and Ajax》 这本书的介绍吧!