Format specifier in scanf for bool datatype in C

前端 未结 1 487
闹比i
闹比i 2020-12-03 17:20

I am using bool datatype in C std99 whose definitions are defined in . Now I want the user to give me input. What format specifier I must use i

1条回答
  •  星月不相逢
    2020-12-03 17:34

    There is none.

    Use a temp object as the size of _Bool is implementation dependent.

    #include 
    #include 
    
    bool b;
    int temp;
    
    scanf("%d", &temp);
    b = temp;
    

    0 讨论(0)
提交回复
热议问题