sprintf 関数を使って、result 変数に文字列 s1 と文字列 s2 を結合した文字列を出力することができる。
例
#include<stdio.h>
int main(void) {
char *s1 = "one";
char *s2 = "two";
char result[50];
sprintf(result, "%s%s",s1,s2);
printf("%s\n", result);
return 0;
}
結果
onetwo
雑記
投稿日:
sprintf 関数を使って、result 変数に文字列 s1 と文字列 s2 を結合した文字列を出力することができる。
#include<stdio.h>
int main(void) {
char *s1 = "one";
char *s2 = "two";
char result[50];
sprintf(result, "%s%s",s1,s2);
printf("%s\n", result);
return 0;
}
onetwo
執筆者:seyanen
関連記事
数学で、y と x が比例するとき「比例記号」を使って表す方法がある。tex で表すには次のようにする。 例 $$ y \propto x $$ 結果 あなたがしてくれなくても 1【電子書籍】[ ハル …
例で、urlcolor=red と書けば、「link to google」の文字列は赤色(red)になる。 もし urlcolor=blue と書けば、リンクは青色になる。 例 \usepackage …
2023/01/18
matplotlib のグラフ作成と gnuplot との対応 比較
2022/10/14
pythonで配列(リスト)の、ある要素がわかっているときにその次の要素を取得する方法。