我如何将argv[]传递给我的函数?当我运行我的程序时,我得到了错误。我是c++的新手,但我认为我没有正确传递它,看看错误和我的代码。现在不用担心深度优先算法..我稍后会讲到的..我只是想让它工作..,基本上我只是想在我的printDepthFirst()中传递*argv[]来评估它们,但是(显然)有些地方是不正确的。谢谢
myprogram.c: In function ‘main’:
myprogram.c:18:4: warning: passing argument 1 of ‘opendir’ makes pointer from integer without a cast
/usr/include/dirent.h:135:13: note: expected ‘const char *’ but argument is of type ‘char代码
发布于 2011-10-03 02:58:42
我想你的意思是写opendir(arg_temp)。arg_temp[1]是arg_temp的第二个字符。不管怎样,我不推荐使用全局变量来传递东西给你的函数。
https://stackoverflow.com/questions/7628506
复制相似问题