在C能长期printf语句被分解成多行? [英] In C can a long printf statement be broken up into multiple lines?
本文介绍了在C能长期printf语句被分解成多行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下语句:
printf("name: %s\targs: %s\tvalue %d\tarraysize %d\n", sp->name, sp->args, sp->value, sp->arraysize);
我要打破它。我试过以下,但它不工作。
I want to break it up. I tried the following but it doesn't work.
printf("name: %s\t
args: %s\t
value %d\t
arraysize %d\n",
sp->name,
sp->args,
sp->value,
sp->arraysize);
我怎样才能打破它?
How can I break it up?
推荐答案
如果你想打破一个字符串字面量多行,可以连接多个串在一起,每行一个,像这样:
If you want to break a string literal onto multiple lines, you can concatenate multiple strings together, one on each line, like so:
printf("name: %s\t"
"args: %s\t"
"value %d\t"
"arraysize %d\n",
sp->name,
sp->args,
sp->value,
sp->arraysize);
这篇关于在C能长期printf语句被分解成多行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文