structure array within a structure
Posted: Tue Jan 19, 2021 8:39 pm
Lately, I've been using the TYPE command to make a structure for use with my assembly code.
I'm making a routine in assembly that will extract multiple name-value pairs back to Qbasic but I'd like to receive it in a special type structure but I don't know if it can be doable in Qbasic. I'll explain in Qbasic code what I'm trying to do:
I hope my code explains it better. But When I try to execute it in Qbasic, it complains at the code here:
and highlights the word "as" and shows as an error "Expected end-of-statement".
Is there a way around this without me having to do this...
I'm making a routine in assembly that will extract multiple name-value pairs back to Qbasic but I'd like to receive it in a special type structure but I don't know if it can be doable in Qbasic. I'll explain in Qbasic code what I'm trying to do:
Code: Select all
Type employee
FirstName as string * 30
LastName as string * 30
Age as integer
End Type
Type product
ProductName as string * 30
ProductPrice as Double
End Type
Type maindata
StoreName as string * 30
employees(10) as employee
products(100) as product
End Type
Dim datatoasm as maindata
'setup name
datatoasm.StoreName="Valu Mart"
'setup first employee
datatoasm.employees(1).FirstName="John"
datatoasm.employees(1).LastName="Smith"
datatoasm.employees(1).Age=66
'setup 2nd employee
datatoasm.employees(2).FirstName="Jack"
datatoasm.employees(2).LastName="Daniels"
datatoasm.employees(2).Age=77
Code: Select all
employees(10) as employee
products(100) as product
Is there a way around this without me having to do this...
Code: Select all
employee1 as employee
employee2 as employee
...
employee10 as employee
product1 as product
product2 as product
product3 as product
...
product99 as product
product100 as product