如果在数组索引之前使用 "!" 运算符表示什么?



我是竞争编程的初学者。我遇到了一个问题,所以我查看我遵循的个人密码。

I didn't understand this following part particularly:

int i,n,a[1005]={},b;
vector<int>v;
cin>>n;
for(i=0;i<n;i++)
{
cin>>b;
if(!a[b])v.push_back(b);
a[b]=i+1;
}

here,  what does the condition "if(!a[b])" denote? I could not find it on google. 
Please help me. Thank you

!表示not运算符。这就是检查变量值的对立面的方法。这是在检查元素b处的数组a是否存在。如果不存在!a[b],则将b推入向量v并更新a[b]。否则,不执行任何操作,只更新a[b]

最新更新