How to convert float to char in C

1 Answer

0 votes
#include <stdio.h> 

int main(void) 
{ 
	float f = 72.98;
	char ch = (char)f;
	
	printf("%d\n", ch);
	
    return 0; 
} 
  
  
  
/*
run:
  
72
 
*/

 



answered Aug 7, 2019 by avibootz

Related questions

1 answer 138 views
138 views asked Jun 20, 2021 by avibootz
1 answer 224 views
1 answer 179 views
3 answers 104 views
104 views asked Mar 5, 2025 by avibootz
1 answer 100 views
1 answer 104 views
104 views asked Feb 8, 2024 by avibootz
...