Originally posted by Eric Pearson
View Post

#COMPILE EXE #DIM ALL GLOBAL myArray() AS STRING FUNCTION PBMAIN() AS LONG LOCAL i AS LONG LOCAL s1,s2,s3 AS STRING DIM myArray(4) FOR i = 0 TO 4 myArray(i) = "Element " & STR$(i) NEXT FOR i = 0 TO 4 s1+= STR$(STRPTR(myArray(i))) NEXT REDIM PRESERVE myArray(6) FOR i = 0 TO 6 s2+= STR$(STRPTR(myArray(i))) NEXT REDIM PRESERVE myArray(2) FOR i = 0 TO 2 s3+= STR$(STRPTR(myArray(i))) NEXT ? s1 & $LF & s2 & $LF & s3 END FUNCTION '
#COMPILE EXE #DIM ALL GLOBAL myArray() AS STRING GLOBAL myArray2() AS STRING FUNCTION PBMAIN() AS LONG LOCAL i AS LONG LOCAL s1,s2,s3,s4,s5,s6,s7 AS STRING DIM myArray(3) FOR i = 0 TO 2 myArray(i) = "Element " & STR$(i) NEXT s1 = STR$(VARPTR(myArray())) & " - " FOR i = 0 TO 3 s1+= STR$(STRPTR(myArray(i))) NEXT REDIM PRESERVE myArray(5) myArray(3) = "123" myArray(5) = "12345" s2 = STR$(VARPTR(myArray())) & " - " FOR i = 0 TO 5 s2+= STR$(STRPTR(myArray(i))) NEXT REDIM PRESERVE myArray(2) s3 = STR$(VARPTR(myArray())) & " - " FOR i = 0 TO 2 s3+= STR$(STRPTR(myArray(i))) NEXT REDIM PRESERVE myArray(5) myArray(4) = "12345" s4 = STR$(VARPTR(myArray())) & " - " FOR i = 0 TO 5 s4+= STR$(STRPTR(myArray(i))) NEXT REDIM myArray(4) myArray(4) = "12345" s5 = STR$(VARPTR(myArray())) & " - " myArray(2) = "12" FOR i = 0 TO 4 s5+= STR$(STRPTR(myArray(i))) NEXT myArray(2) = "" s6 = STR$(VARPTR(myArray())) & " - " FOR i = 0 TO 4 s6+= STR$(STRPTR(myArray(i))) NEXT DIM myArray2(3) s7 = STR$(VARPTR(myArray2())) & " - " myArray2(1) = "12" FOR i = 0 TO 2 s7+= STR$(STRPTR(myArray2(i))) NEXT LOCAL sTmp,s8,s9,s10 AS STRING s8 = STR$(STRPTR(sTmp)) stmp = "123" s9 = STR$(STRPTR(sTmp)) sTmp = "" s10 = STR$(STRPTR(sTmp)) ? s1 & $LF & s2 & $LF & s3 & $LF & s4 & $LF & _ "Redim and myarray(2) set" & $LF & s5 & $LF & _ "MyArray(2) reset to zero length" & $LF & s6 & $LF & _ "A different Global array with MyArray2(1) set:" & $LF & s7 & $LF & _ "A local uninitialised string" & $LF & s8 & $LF & _ "The string once initialise" & $LF & s9 & $LF & _ "The string reset to zero length" & $LF & s10 END FUNCTION '
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment