如何在输出函数中连接字符串?

用户14040321

有些语言有简单的方法来做到这一点,但我的问题围绕 C 和 C++。

我想在 Java 中做这样的事情:

public class sandbox {
    public static void main(String[] args) {
        System.out.println("Thank" + " you!");
    }
}

并将其转移到 C 中:

#include <stdio.h>

int main() {
    /* The easiest way is like this:
        char *text1 = "Thank";
        char *text2 = " you";
        printf("%s%s\n", text1, text2);
    */
    printf("Thank" + " you."); // What I really want to do
}

如何在这样的语言中连接字符串?

克里斯托弗·叶莱顿

你什么都不用:

puts ("Thank" " you.");

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章