非常に短い質問をさせてください:
文字の配列(小文字のみとしましょう)があり、各文字をアルファベットの次の文字にしたいです。「z」が「a」になると考えてください。私は使うだろう:
while (s[i] != '\0')
{
if (s[i] == 'z')
s[i] = 'a');
else
s[i] += 1;
i++;
}
右?さて、ポインターを使用する必要がある場合は、代わりに次のように言います。
while (*s != '\0')
{
if (*s == 'z')
*s = 'a');
else
*s += 1; //Don't know if this is correct...
s++; //edited, I forgot D:
}
ありがとうございました!