Trouble with array of linked_list elements

by Creative Bachkhoa (modified: 2009 Nov 11)

I represent an adjacency list of graph G(V,E). feature adj_list: ARRAY[LINKED_LIST[INTEGER]] feature make(vertices: INTEGER) local i: INTEGER do create adj_list.make(1,vertices) from i:=1 until i > adj_list.upper loop create adj_list[i].make io.put_string("Enter the vertices match to vertex ") io.put_integer(i) io.put_string (":%T") read_list(adj_list[i]) i:=i+1 end end

The compile said "expression cannot be used as instruction"  at the stage "create adj_list[i].make " 
 Does it make sense? Can anybody help me fix it? 

  • Manu (14 years ago 12/11/2009)

    You should ask your question to

    The issue here is that you need to create an entity and then assign it to the array.

    adj_list [i] := create {LINKED_LIST [INTEGER]}.make

    • Creative Bachkhoa (14 years ago 18/11/2009)

      thanks, it works well.