Visual Studio 2019:抛出例外:阅读访问违规。 ** argv **是0x2
我正在尝试将命令行的参数传递到我的程序中。我将其设置在属性菜单中。
当我运行以下代码时:
#include <stdio.h>
int main(const char *argv[], int argc) {
printf("%s", *argv);
return 0;
}
我会收到此错误:
抛出的例外:阅读访问违规。 argv 为0x2
i在两个设置中都设置为“ DEUBG X64”。有什么建议吗?
I'm trying to pass command-line arguments into my program. I have it set in the properties menu.
When I run the following code:
#include <stdio.h>
int main(const char *argv[], int argc) {
printf("%s", *argv);
return 0;
}
I get this error:
Exception thrown: read access violation. argv was 0x2
I have the debugger set to "Deubg x64" in both settings. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
main
的参数不正确。他们应该是:The arguments to
main
aren't in the correct order. They should be: