c program doesn't work scanf char

后端 未结 2 1469
北荒
北荒 2020-12-22 09:59
#include 
int main() {

    struct cerchio c1, c2;
    float distanza;
    char k;

    //input del centro del primo cerchio
    printf(\"Enter the co         


        
2条回答
  •  眼角桃花
    2020-12-22 10:40

    use

    scanf(" %c",&k);
    

    Instead of

    scanf("%s", &k); // %s is used for strings, Use %c for character variable.
    

    for char variable use " %c". and don't forget to keep space before %c " %c" , it will skips newline and whitespace characters.

提交回复
热议问题