C言語で文字をずらすには、char 型の変数に1を加えればよい。
例
#include <stdio.h>
int main(void)
{
char c;
c = 'a';
c++;
printf("c is %c\n",c);
return 0;
}
結果
c is b
‘a’ という文字(char)を1つずらして、b に変更する。
雑記
投稿日:2020年11月11日 更新日:
C言語で文字をずらすには、char 型の変数に1を加えればよい。
#include <stdio.h>
int main(void)
{
char c;
c = 'a';
c++;
printf("c is %c\n",c);
return 0;
}
c is b
‘a’ という文字(char)を1つずらして、b に変更する。
執筆者:seyanen
関連記事
\newcommand を使って指定する。入力の数は自由に指定できる。 例 \newcommand{\variable}[2]{Hello #1. Good #2.} \variable{Taro}{ …
python3 でカンマの入った数値の文字列を数値に変換する方法
replace と int 変換を組み合わせる。 例 str1 = ‘1,234,567’ int1 = int(str1.replace(‘,’,”)) print(int1) 結果 123456 …
python3 で文字列のリストを結合して1つの文字列にする方法
リストに対して、join メソッドを実行する。 例 list1 = [‘hello, ‘,’good ‘, ‘morning’] str1 = ”.join(list1) print(str1) 結 …
分子・分母にシグマ記号(和記号)を使うと、小さくつぶれて見にくいことがある。対策として、\displaystyle を使う。 例 $\frac{\displaystyle \sum_{i=1}^{\i …
python3 で、文字列を一文字ずつのリストに変換する方法
string を list() で変換すれば良い。 例 str1 = ‘Good morning.’ list1 = list(str1) print(list1) 結果 [‘G’, ‘o’, ‘o’ …
2023/01/18
matplotlib のグラフ作成と gnuplot との対応 比較
2022/10/14
pythonで配列(リスト)の、ある要素がわかっているときにその次の要素を取得する方法。