查找元素,这段答案有什么错误应该怎么改
修改如下,供参考:
search函数中把else return -1去掉,在for循环外加上 return -1。函数调用改为search(list,n,x),使用函数名作参数