Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and works. Contact: aviboots(AT)netvision.net.il
BlueHost Web Hosting

Bonsai Boy of New York Bonsai Trees and Accessories

Liquid Web iThemes WordPress Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

DreamHost Web Hosting


getResponse autofunnels

Liquid Web Cloud VPS Hosting

11,818 questions

16,089 answers

573 users

How to convert float to bool in C

2 Answers

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

int main(void) 
{ 
    float f = 0.0;
	bool b = f != 0.0;
	
    fputs(b ? "true" : "false", stdout);
     
    return 0; 
} 
   
   
   
/*
run:
   
false
 
*/

 




answered Aug 11 by avibootz
0 votes
#include <stdio.h> 
#include <stdbool.h>

int main(void) 
{ 
    float f = 3.14;
	bool b = f != 0.0;
	
    fputs(b ? "true" : "false", stdout);
     
    return 0; 
} 
   
   
   
/*
run:
   
true
 
*/

 




answered Aug 11 by avibootz
...