articleTrouble with array of linked_list elements

creative.bachkhoa's picture

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?

Comments

You should ask your question

manus_eiffel's picture

You should ask your question to http://groups.eiffel.com.

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

thanks, it works well.

creative.bachkhoa's picture

thanks, it works well.

Syndicate content