String comparison C - strcmp()

前端 未结 4 869
别那么骄傲
别那么骄傲 2021-01-24 21:28

I\'m trying to compare two strings, but I fail achieving that. Why?

#include 
#include 

int main(){
    float a = 1231.23123;
            


        
4条回答
  •  深忆病人
    2021-01-24 21:58

    It's because the precision of float cannot support so many digits. So b is not "1231.23123". In my test, it's "1231.231201".

提交回复
热议问题