[英]How do I pass a function with an argument of a structure passed by reference?
[英]How do I pass an argument that was passed to main (in argv) to my function?
如何将argv []传递给我的函数?我在运行程序时遇到错误。 我是c ++的新手,但我认为我没有正确地查看错误和我的代码。 现在不用担心深度优先算法..我将在稍后进行...我只是想让这个工作..,基本上我只是想传递* argv []来评估它们在我的printDepthFirst()中但是有些东西是不对的(显然)..谢谢
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
码
我想你打算写opendir(arg_temp)
。 arg_temp[1]
是arg_temp
的第二个字符。 无论如何,我不建议使用全局变量将事物传递给你的函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.