Interactive PowerBasic Forum

IT-Consultant: Charles Pegge => OxygenBasic Examples => Topic started by: Charles Pegge on February 03, 2025, 11:07:49 PM

Title: A Brief Review of Redim
Post by: Charles Pegge on February 03, 2025, 11:07:49 PM
Redimensioning inside a function.
Accessing the array attributes.

'REDIM REVIEW
uses console
indexbase 1

'#majorminor 'order for 'C' FreeBasic default
#minormajor  'order for PowerBasic

function redims4(int*aa[redim], int d1,d2,d3,d4)
redim int aa[d1,d2,d3,d4]
end function

redim int a[0,0,0,0]
redims4(a,5,6,7,8)
'
print "attributes of Array a " cr cr
print "type: " typeof(a) cr
print "current elements: " ubound(a) cr
print "current size: " ubound(a) * sizeof(a) cr

print "dimensions: " dims(a) cr cr
print "dim n" tab "scaler" tab "strider" tab "ubound" cr cr
int i
for i=1 to dims(a)
   print i tab scaler(a,i) tab strider(a,i) tab ubound(a,i) cr
next

wait