How to pass a string[string] array to a function

Hello everyone,
I was tring to use as input of an external funciton a string[string] array but for some reasons, it does not seemes to be possible. FreeFEM does not give any allert of error, but it does not give any output. Here below is reported a trivial example just to highlight the problem.

Thank you in advance!
Christian

readstringarray.idp (130 Bytes)
stringstringarrayexample.edp (603 Bytes)

Your code does not run with an error message.

   20 : string givemecolor=readarray(arrayofstrings); The identifier givemecolor exists 
 	  the existing type is <PPNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE>
 	  the new  type is <PPNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEE>
1 Like

Furthermore, if you remove the second definition of givemecolor, and switch in readstringarray.idp from an input of type string[string] to an input of type string[string]&, then the code runs OK.

$ FreeFem++ stringstringarrayexample.edp -v 0
CIAO1
The color of the fruitis:  yellow
CIAO2
1 Like

Sorry! I forgot to delete the code line “string givemecolor=readarray(arrayofstrings);” at the start!
Thanks for the tip, it works perfectly now!