This question already has answers here:
A>=B>=C operators in C? [duplicate]
                                
                                    (3个答案)
                                
                        
                                4年前关闭。
            
                    
两者在逻辑上是相同的,但是它们的工作方式不同:

if (e >='A' && e <= 'Z')




if('A' <= e <= 'Z')


第一行代码正确,但是第二行无效。为什么?

最佳答案


if( ('A' <= e) <= 'Z')


'A'
if (0 <= 'Z')


要么

if (1 <= 'Z')

关于c - if('A'<= e <='Z')和if(e> ='A'&& e <='Z')之间的区别,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32500736/

10-11 22:09