27 lines
463 B
Text
27 lines
463 B
Text
void
|
|
search(list l, text s)
|
|
{
|
|
integer i;
|
|
|
|
i = 0;
|
|
while (i < ~l) {
|
|
if (l[i] == s) {
|
|
break;
|
|
}
|
|
i += 1;
|
|
}
|
|
|
|
o_(s, " is ", i == ~l ? "not in the haystack" : "at " + itoa(i), "\n");
|
|
}
|
|
|
|
integer
|
|
main(void)
|
|
{
|
|
list l;
|
|
|
|
l = l_effect("Zig", "Zag", "Wally", "Ronald", "Bush", "Krusty",
|
|
"Charlie", "Bush", "Boz", "Zag");
|
|
__ucall(search, 1, 1, l, "Bush", "Washington", "Zag");
|
|
|
|
return 0;
|
|
}
|