The following doesn't work because you can't pass an array name as an argument to a func. Is there a way to accomplish what I am trying by passing a reference to the array I want to search with the "func searchArray"?
Thanks for the help.
proc main
string myArray[10]
integer result
myArray[0] = "hi there"
myArray[1] = "good bye"
result = searchArray( myArray, "good bye" )
termmsg "index for string `"good by`" is: %d", result
endproc
func searchArray : integer
param string searchStr
param string localArray[10]
integer index
for index = 0 upto sizeofarray( localArray )
if ( strcmp( searchStr, localArray[index])
return( index )
endfor
; could not find the search string
return ( -1 )
endfunc
Thanks for the help.
proc main
string myArray[10]
integer result
myArray[0] = "hi there"
myArray[1] = "good bye"
result = searchArray( myArray, "good bye" )
termmsg "index for string `"good by`" is: %d", result
endproc
func searchArray : integer
param string searchStr
param string localArray[10]
integer index
for index = 0 upto sizeofarray( localArray )
if ( strcmp( searchStr, localArray[index])
return( index )
endfor
; could not find the search string
return ( -1 )
endfunc