1

is it possible to get a scanf of a value generated with the standard library '<stdbool.h>'? For example if you wanted to scan the value of 'bool check;' where check is the name how can I do this without assigning it to another element? Here is a simple example that explain what I want to do:

#include <stdio.h>
#include <stdbool.h>

int main(void){
    int x; // without using int X; it's possible to scanf the 'bool check' ?
    bool check;

    printf("Do you have a dog? \n(1=yes 0=no)\n");
    scanf("%d",&x);
    check=x;
    
    if(check == true){
        printf("Good! I love dogs :)");
    }else{
        printf("You need to buy one! \nThey're very cute...");
    }
}
Leonardo
  • 123
  • 2
  • 13

0 Answers0