Retrieving an Element of an Array: Difference between revisions
Content added Content deleted
(→{{header|C}}: + AWK) |
|||
Line 71: | Line 71: | ||
return item location in array |
return item location in array |
||
end getArrayValue |
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}}== |
=={{header|C}}== |