This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center
                            
                        
                    
                
                                6年前关闭。
            
                    
我有下面的代码。但是,我认为答案是4。我对吗?

int a, i;

if (execute)
{
  int count = 0;
  for (i=0; i<5; i++)
  {
    if(pcnt[i]) count ++;
  }
  a = (count > 0)
}
else
{
  a= 0;
}


对于IF情况,a是a = 1还是a = 4?

最佳答案

a将是10

1:如果execute != 0count >0

0:否则

注意:

count >0当且仅当pcnt[0]!=0pcnt[1]!=0pcnt[2]!=0pcnt[3]!=0pcnt[4]!=0

关于c - 此逻辑的输出是什么? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15637578/

10-11 03:22