با سلام خدمت دوستان گرامی. من یه سوالی راجع به bascome-avr دارم .می خوام بدونم که میشه تو bascome یه آرایه 3 بعدی تعریف کرد ؟ مثلا X[10][10][5]
اگه کسی می دونه لطفا کمک کنه.با تشکر
اگه کسی می دونه لطفا کمک کنه.با تشکر
[left] Const cArrayD1 = 7 ' define here Size of dimension 1 Const cArrayD2 = 13 ' define here Size of dimension 2 Const cArrayD1D2 = cArrayD1 * cArrayD2 ' sum of elements in 2d-Array Dim bArray2D(cArrayD1D2) as Byte ' hold the data of the 2d-array Declare Function GetArray2D (D1 as Byte, D2 as Byte) as Byte Declare Sub SetArray2D (D1 as Byte, D2 as Byte, pValue as Byte) as Byte Dim b1 as Byte ' counter for D1 Dim b2 as Byte ' Counter for D2 Dim b3 as Byte ' array value to write and read B3 = 0 print "Writing a value to each element of the 2d-array" Print "D1 D2 Value" For B1 = 1 To Carrayd1 for b2 = 1 to cArrayD2 setArray2D b1, b2, b3 print b1; " " ; b2 ; " " ; b3 incr b3 next next print "Reading each element of the 2d-array" Print "D1 D2 Value" for b1 = 1 to cArrayD1 for b2 = 1 to cArrayD2 b3 = GetArray2D(b1, b2) print b1; " " ; b2 ; " " ; b3 next next end '------------------------------------------------------------- Function Getarray2d(d1 As Byte , D2 As Byte) As Byte Local WArrayPointer as Word wArrayPointer = d1 - 1 wArrayPointer = wArrayPointer * cArrayD2 wArrayPointer = wArrayPointer + D2 GetArray2D = bArray2D(wArrayPointer) end Function Sub SetArray2D (D1 as Byte, D2 as Byte, pValue as Byte) as Byte Local WArrayPointer as Word wArrayPointer = d1 - 1 wArrayPointer = wArrayPointer * cArrayD2 wArrayPointer = wArrayPointer + D2 bArray2D(wArrayPointer) = pValue end Sub [/left]
دیدگاه