C言語のsingle quoteとdouble quoteの違い
double quote ... 文字列リテラル
"Hello" => 'h', 'e', 'l', 'l', 'o', '\0'
single quote
'a' => 61
関数の引数が
char chなのか
それともchar *str なのか(=char[])は見ておかないとダメ
const char *str
まて
この2つのパターンの組み合わせ
strがmutableな場合とimmutableな場合
pointerがmutableな場合とimmutableな場合
char* is a mutable pointer to a mutable character/string.
const char* is a mutable pointer to an immutable character/string. You cannot change the contents of the location(s) this pointer points to. Also, compilers are required to give error messages when you try to do so. For the same reason, conversion from const char * to char* is deprecated.
char* const is an immutable pointer (it cannot point to any other location) but the contents of location at which it points are mutable.
const char* const is an immutable pointer to an immutable character/string.
restrict
code:c
//#include <boolean.h>
int main() {
char message[] = "Hello world!";
puts("fputc: ");
int i = 0;
while (true) {
if (ch == '\0')
break;
snprintf(buf, sizeof buf, "%c", ch);
}
fputc('\n', stdout);
return 0;
}