Previous: Library Functions Summary, Up: Library Functions [Contents][Index]
gawk
’s ARGIND
variable. Can this
problem be solved without relying on ARGIND
? If so, how?
ARGV
is a variable assignment.
walk_array()
function by adding an additional parameter named
process
.
Then, inside the loop, instead of printing the array element’s index and
value, use the indirect function call syntax (see Indirect Calls)
on process
, passing it the index and the value.
When calling walk_array()
, you would pass the name of a
user-defined function that expects to receive an index and a value,
and then processes the element.
Test your new version by printing the array; you should end up with output identical to that of the original version.