Thread overview | |||||
---|---|---|---|---|---|
|
January 24, 2005 constants and power | ||||
---|---|---|---|---|
| ||||
<code> void main(){ const int num1 = 10^2; const int num2 = 100^2; const int num3 = 1000^3; printf("%d %d %d\n", num1, num2, num3); } </code> <output> 8 102 1003 </output> -manfred |
January 24, 2005 Re: constants and power | ||||
---|---|---|---|---|
| ||||
Posted in reply to Manfred Nowak | Manfred Nowak wrote:
> <code>
> void main(){
> const int num1 = 10^2;
> const int num2 = 100^2;
> const int num3 = 1000^3;
> printf("%d %d %d\n", num1, num2, num3);
> }
> </code>
>
> <output>
> 8 102 1003
> </output>
>
> -manfred
"^" is the XOR-Operator not power. i.e.
10 dec = 0b1010 in binary
0b1010 ^ 0b10 = 0b1000
0b1000 is 8 in decimal
|
January 24, 2005 Re: constants and power | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lukas Pinkowski | Lukas Pinkowski wrote:
[...]
> "^" is the XOR-Operator
Arghhhh, severe black out on my side :-(
Thx.
-manfred
|
Copyright © 1999-2021 by the D Language Foundation