首頁  >  文章  >  後端開發  >  寫一個C程序,印出“ Tutorials Point ”,不使用分號

寫一個C程序,印出“ Tutorials Point ”,不使用分號

WBOY
WBOY轉載
2023-09-11 18:05:021371瀏覽

写一个C程序,打印“ Tutorials Point ”,不使用分号

在不使用分號的情況下列印任何字串,我們需要了解標準輸出的工作原理以及為什麼使用分號。

分號是行結束語句,用來告訴程式該行在此結束。這裡使用的標準列印語句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 to func givenments 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 stateuse of end of line #Using this we can find ways to bypass the stateuse of end of line #Using this we can find ways to bypass the statement while of line #Using 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.

od methodrere s#There several method by which we can print statement without using the semicolon;

#Using the if condition

#include<stdio.h>
int main() {
   if (printf("Tutorials point") )
   { }
}

Using the switch statement

#include<stdio.h>
int main() {
   switch (printf("Tutorials point") )
   { }
}

Using the while loop

#include<stdio.h>
int main() {
   while (printf("Tutorials point") )
   { }
}

###############################################################夫使用巨集###
#include<stdio.h>
#define Out printf("Tutorials point")
int main() {
   switch (out)
   { }
}
###

以上是寫一個C程序,印出“ Tutorials Point ”,不使用分號的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:tutorialspoint.com。如有侵權,請聯絡admin@php.cn刪除