C言語のsingle quoteとdouble quoteの違い
from C言語逆引きメモ
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
まて
c - Difference between char* and const char*? - Stack Overflow
この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
https://ja.wikibooks.org/wiki/C言語/restrict
code:c
#include <stdio.h>
//#include <boolean.h>
int main() {
char message[] = "Hello world!";
char buf12;
puts("fputc: ");
int i = 0;
while (true) {
char ch = messagei++;
if (ch == '\0')
break;
snprintf(buf, sizeof buf, "%c", ch);
fputc(buf0, stdout);
}
fputc('\n', stdout);
return 0;
}