为什么return会导致非法语法?

编程入门 行业动态 更新时间:2024-10-21 16:23:47
本文介绍了为什么return会导致非法语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

main(int argc,char * argv []) { (main&& argc)? main(argc-1,NULL):返回0; //第1行 } 1.我能否知道为什么使用return会导致非法语法...我猜它 与命令行参数有关.. 2.任何人都可以解释第1行吗?它有点令人困惑....

main(int argc, char *argv[]) { (main && argc) ? main(argc-1, NULL) : return 0; //line 1 } 1. Can I know why using return causes an illegal syntax...I guess it has something to do with command line arguments.. 2. can anyone explain the line 1?? its a bit confusing....

推荐答案

ch ******* @ yahoo 写道: main(int argc,char * argv []) { (主&& argc)? main(argc-1,NULL):返回0; //第1行} 1.我能否知道为什么使用return会导致非法语法...我猜它与命令行参数有关.. 2.谁能解释一下1号线?它有点令人困惑.... main(int argc, char *argv[]) { (main && argc) ? main(argc-1, NULL) : return 0; //line 1 } 1. Can I know why using return causes an illegal syntax...I guess it has something to do with command line arguments.. 2. can anyone explain the line 1?? its a bit confusing....

1.不,这是因为`return''是一个陈述,而不是表达。 2简单语法错误。下一个? - g - Artie Gold - 德克萨斯州奥斯汀 goldsays.blogspot www.cafepress/goldsays 如果你无需隐藏,你我没有尝试!

1. No, it''s because `return'' is a statement, not an expression. 2. Simple. Syntax error. Next? --ag -- Artie Gold -- Austin, Texas goldsays.blogspot www.cafepress/goldsays "If you have nothing to hide, you''re not trying!"

我的意思是声明的第一部分(主要&& argc)是什么? main (argc-1,NULL):返回0; 确实... IGNORE返回的存在... I meant what does first part of the statement (main && argc) ? main(argc-1, NULL) : return 0; does...IGNORE THE PRESENCE OF return...

2006年1月17日07:15:34 -0800,在comp.lang.c中,ch ******* @ yahoo < ch ***** **@yahoo>写道: On 17 Jan 2006 07:15:34 -0800, in comp.lang.c , "ch*******@yahoo" <ch*******@yahoo> wrote: main(int argc,char * argv []) {(main&& argc)? main(argc-1,NULL):返回0; //第1行} 1。我能否知道为什么使用return会导致非法语法... 三元运算符的操作数必须是同一类型,例如两者都是 numeric,两个相同的结构类型,两个指向相同类型的指针, 都是void等等。return 0没有类型,与 类型的main()不一样是int。 写这个的正确方法(这是一个例子)一个递归的 main,而且在C ++中是违法的)) return(main&& argc)? main(argc-1,NULL):0; 与命令行参数有关.. 2。任何人都可以解释这条线路吗??它有点令人困惑.... main(int argc, char *argv[]){(main && argc) ? main(argc-1, NULL) : return 0; //line 1}1. Can I know why using return causes an illegal syntax... The operands of the ternary operator must be of the same type, eg both numeric, both the same struct type, both pointers to the same type, both void, etc etc. "return 0" has no type and is not the same as the type of main() which is int. The correct way to write this (which is an example of a recursive main, and illegal in C++ by the way) ) is return (main && argc) ? main(argc-1, NULL) : 0; has something to do with command line arguments..2. can anyone explain the line 1??its a bit confusing....

你在哪里得到这个垃圾?这是你发布的第三个完全无意义的代码 代码。你想做什么? 另外,当发布到CLC时,你应该发布#include任何 相关标题的片段。在这种情况下,你需要一些东西来定义NULL。 马克麦金太尔 - ---- ==发表通过Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News == ---- http: //www.newsfeeds 世界排名第一的新闻组服务! 120,000多个新闻组 ---- =东海岸和西海岸服务器农场 - 通过加密实现全隐私= ----

Where do you get this rubbish? This is the third total nonsense bit of code you''ve posted. What are you trying to do? Also, when posting to CLC, you should post snippets which #include any relevant headers. In this case, you need something to define NULL. Mark McIntyre -- ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==---- www.newsfeeds The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =----

更多推荐

为什么return会导致非法语法?

本文发布于:2023-11-03 15:38:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1555468.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语法   return

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!