1. 首页
  2. 易语言 - EasyLanguage
  3. 二维数组 Two-dimensional Arrays

二维数组 Two-dimensional Arrays

A C++ function code example to illustrate how this works:

void __stdcall ARRAYTESTFUNC 
( IEasyLanguageObject* pELObj, char* sArrayName ) 
{ 
	IEasyLanguageVariable* pELArray = pELObj->Variables[ sArrayName ] ; 
	pELArray->SelectedIndex[0] = 0 ; 
	pELArray->SelectedIndex[1] = 0 ; 
	pELArray->Value[0] = 1 ; 
	pELArray->SelectedIndex[0] = 0 ; 
	pELArray->SelectedIndex[1] = 1 ; 
	pELArray->Value[0] = 2 ; 
	pELArray->SelectedIndex[0] = 1 ; 
	pELArray->SelectedIndex[1] = 0 ; 
	pELArray->Value[0] = 3 ; 
	pELArray->SelectedIndex[0] = 1 ; 
	pELArray->SelectedIndex[1] = 1 ; 
	pELArray->Value[0] = 4 ; 
} 

Here is the EasyLanguage code used for testing:

external: "ArrayTest.dll", void, "ARRAYTESTFUNC", IEasyLanguageObject, LPSTR ; 
 
arrays:  TestArray[1, 1]( 0 ) ; 
 
if LastBarOnChart then 
	begin 
	ArrayTestFunc( self, "TestArray" ) ; 
	Print( TestArray[0, 0], " ", TestArray[0, 1], " ", TestArray[1, 0], " ", 
	 TestArray[1, 1] ) ; 
 	end ; 
更新于 2020年6月2日

这篇文章对您有帮助吗?

相关的话题

留言评论