What's the meaning of binary(number >> 1)
, and how does it work in the following code? Could somebody explain it to me in detail? Thank you!
#include <iostream.h>
void binary(int);
int main() {
int number = 3;
cout << number << endl;
binary(number);
}
void binary(int number) {
if(number <= 1) {
cout << number;
return;
}
int remainder = number%2;
binary(number >> 1); //How does this work exactly?
cout << remainder;
}