[Solved] What is the output of the following code and how?


for(;*s; r=(r<<1)|(*s++ - '0'));//explain this 

is:

int r=0;
while(*s){
  int m=*s-'0';
  r=r*2 + m;    
  ++s;
}

As commented above It will parse(convert) your binary string to number

solved What is the output of the following code and how?