Jump to content

Retrieving an Element of an Array: Difference between revisions

Line 71:
return item location in array
end getArrayValue
 
=={{header|AWK}}==
This shows how a string is split into elements of the array a, which is iterated over, and its elements printed to stdout. Note that the order is not as original, because the array is implemented as a hash table.
$ awk 'BEGIN{split("a b c d",a);for(i in a)print a[i]}'
d
a
b
c
 
=={{header|C}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.