将字符连接到句子c

将字符连接到句子c,c,concatenation,string-concatenation,sentence,C,Concatenation,String Concatenation,Sentence,如何在句子中添加字符 例如,我有一个player1,想在句子的开头添加player1“请输入你想洗牌多少次” 我已经习惯了java,在java中,您只需将+添加到其中,即可连接变量和字符串 到目前为止,我有这个,但它不喜欢我键入的任何内容: printf(&player1 + " please enter how many times you would like to shuffle the deck: "); int numShuf; scanf("%i", &numShuf

如何在句子中添加字符

例如,我有一个player1,想在句子的开头添加player1“请输入你想洗牌多少次”

我已经习惯了java,在java中,您只需将+添加到其中,即可连接变量和字符串

到目前为止,我有这个,但它不喜欢我键入的任何内容:

printf(&player1 + " please enter how many times you would like to shuffle the deck: ");
int numShuf;
scanf("%i", &numShuf);
任何帮助都将不胜感激

请尝试以下方法:

printf("%s please enter how many times you would like to shuffle the deck: ", player1);

printf
意味着打印格式化,因此您可以格式化要打印的内容,并将变量添加为参数。

@kevorski将其放在一行是什么意思?@austin当我打印它时,我得到了这个
kevin,请输入您希望将该组数据洗牌多少次:
它在两个单独的页面上打印lines@kevorski字体换行符只能出现在
kevin
之后,并且换行符会出现在那里,因为您在中阅读时没有删除
kevin
名字后面的换行符。