如何在C 中读取/解释复杂的表达式
How to read/interpret complicated expressions in C++
类似的东西:
int ctr[], i, distinct = 0;
string s;
distinct += ctr[s[i]]++ == 0; // <-- This line
我了解数组的符号以及哪些增量和减少运算符。我只是不明白这样写的方式。更重要的是,这样写的目的。
它就像以下代码:
char c = s[i];
distinct = distinct + ctr [x]; // "value +=" is the same as "value = value + ..."
ctr[c]++; // char is used as number here. The c. element in ctr[] is incremented.
//because of c++ instead of ++c the increment is done after all.
distinct == 0 // returns a boolean value into nirvana :)
我希望这对您有帮助。
但是,如果您想编码,则不应像这样编写代码。尤其是如果您想将来阅读代码或希望其他人阅读; - )
相关文章:
- 请解释"函数1(p1,p2,p3);"的输出
- 函数复杂度分析
- 请解释这句话(cout<<1+int((a<b)^((b-a)&1) )<<endl
- 向量 <int> a {N, 0} 和 int arr a[N] = {0} 的时间复杂度有什么区别
- while循环中while循环的时间复杂度是多少
- 被解释为低级别const的const对象的地址
- 计算每个节点的树高,帮助我解释这个代码解决方案
- MSVC将仅移动结构参数解释为指针
- 内联程序集printf将整数解释为地址
- 有人能解释一下为什么下界是这样工作的吗C++的
- Visual Studio(或任何其他工具)能否将地址解释为调用堆栈(boost上下文)的开头
- 我是c ++的新手,你能解释一下在这种情况下的指针吗
- 有人能为我解释一下C++代码吗
- 解释复杂的C++定义
- 如何在C 中读取/解释复杂的表达式
- 有人可以向我解释一个复杂的函数指针类型吗C++
- 用指针解释复杂的类型定义
- 算法复杂度- O(log n)的解释
- 算法时间复杂度类型解释
- 解释这些分组函数的时间复杂度