首页 > 解决方案 > my c program con't go ahead (only scanf and printf in it)

问题描述

Thread 1: EXC_BAD_ACCESS (code=1, address=0x25630a) this is my first time use xcode and learn c. I just want to scanf a lowercase letter and change it into an uppercase letter. but I can't stop my program and don't know what happend now.

int main () {
    char ch;
    scanf("%c", &ch);
    ch = ch - 32;
    printf('%c\n', ch);
    return 0;
}

enter image description here

标签: c

解决方案


int main () {
    char ch;
    scanf("%c", &ch);
    ch = ch - 32;
    printf("%c\n", ch);
    return 0;
}

哦,这是我的代码。我把它放在这里,不需要看图。

我知道我有什么错误, c 不能使用单引号

谢谢


推荐阅读