C语言爆零,求助

P1914 小书童——凯撒密码

darkwilldie @ 2022-11-21 14:19:19

#include <stdio.h>
int main(void)
{

    int n;
    char ch;
    scanf("%d", &n);
    getchar();
    while ((ch = getchar()) <= 'z' && ch >= 'a')
    {
        ch = (ch - 'a' + n) % 26 + 'a';
        printf("%c",&ch);
    }
    return 0;
}

by Gunpowder_OI @ 2022-11-21 14:24:35

printf的时候不用取地址

printf ("%c", ch);

|