
在不使用分号的情况下打印任何字符串,我们需要了解标准输出的工作原理以及为什么使用分号。
分号是一种行结束语句,用于告诉程序该行在此结束。这里使用的标准打印语句printf是标准io库的一种方法。让我们深入了解printf()方法。
int printf(const char *format , ...)
This method returns an integer and has a set of arguments format and … . The format is a string that is printed in the output screen. And the … is the additional number of arguments that are given to the function based on the string.
The funnctions return the total number of character that is to be printed on the screen.
Using this we can find ways to bypass the use of end of line statement while printing the statement. We can use some statements that do not require the end of LINE statement to execute like the for loop. We can use this to print are set a statement without using the semicolon.
There are several methods by which we can print statement without using the semicolon;
Using the if condition
#includeint main() { if (printf("Tutorials point") ) { }}
Using the switch statement
#includeint main() { switch (printf("Tutorials point") ) { }}
Using the while loop
#includeint main() { while (printf("Tutorials point") ) { }}
使用宏
#include#define Out printf("Tutorials point")int main() { switch (out) { }}
以上就是写一个C程序,打印“ Tutorials Point ”,不使用分号的详细内容,更多请关注创想鸟其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 chuangxiangniao@163.com 举报,一经查实,本站将立刻删除。
发布者:程序猿,转转请注明出处:https://www.chuangxiangniao.com/p/1444922.html
微信扫一扫
支付宝扫一扫