FAQ Database Discussion Community


prefix and postfix operators c++

c++,operators,postfix-operator,prefix-operator
class compl{ float re,im; public: compl(float r, float i) {re=r; im=i;} compl& operator++() {++re; return*this;} //(1) compl operator++(int k){ compl z=*this; re++; im+=k; return z;} //(2) friend compl& operator--(compl& z) {--z.re; return z;} friend compl operator--(compl& z,int k) {compl x=z; z.re--; z.im-=k; return x;} }; (1) Why do we have...

Different server different output in same php version

php,postfix-operator,prefix-operator
I have two PHP server where i installed same php 5.6.8, but one server is windows and another is linux . When i write this code the output of code is different on different server. $x=5; echo $x."".++$x."".$x++; Why does it give different answers on different server?...

Postfix operators in while loops

c++,while-loop,postfix-operator
I was looking through some C++ code today when I stumbled upon this: while (c--) { a = (a + 1) % n; while(arr[a]) a = (a + 1) % n; } c was an integer. Don't while loops take boolean expressions to be evaluated? I know 1 and 0...