Re: structures and arrays

new topic     » topic index » view thread      » older message » newer message

-- Isn't this is a structure ????

global sequence structure_name

integer dot_name, dot_address, dot_phone, dot_salary

dot_name       = 1
dot_address    = 2
dot_phone      = 3
dot_salary     = 4

-- Be sure you allocate enough items for the structure (sequence)
-- This is a simple way to do this, but you can use default data if you want

structure_name = {dot_name,dot_address,dot_phone,dot_salary}


-- Enter Data into structure

structure_name[dot_name]    = "Mr. Anyname"
structure_name[dot_address] = "123 east any street"
structure_name[dot_phone]   = "123-4567"
structure_name[dot_salary]  = 5000000

-- Get Data from structure and print it

puts(1, structure_name[dot_name]    &"\n\n" )
puts(1, structure_name[dot_address] &"\n\n" )
puts(1, structure_name[dot_phone]   &"\n\n" )
printf(1, "Salary : %d dollars\n\n", structure_name[dot_salary])

-- Dont Forget using Eu code can form dynamic structures of any type
-- in other langauges you are locked into specific data types.
-- And I will bet a clever programmer could even manipulate the
-- structure to use Unions

-- As for Arrays, They are really just sequences.
-- Sequences can form dynamic multidimensional arrays
-- that can store a different type of data in each element.
-- Is there any other language that you can do that in.
--
-- My opinion is that we should look for new ways to use the language
-- and not try to find ways to change the language.

--                           o  o
--                            ||
-- Thanks for your attention (..) Bernie
--                            __

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu