Format specifier in scanf for bool datatype in C

前端 未结 1 480
闹比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 <stdbool.h>
    #include <stdio.h>
    
    bool b;
    int temp;
    
    scanf("%d", &temp);
    b = temp;
    
    0 讨论(0)
提交回复
热议问题