010
10.1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
10.1
10.2
10.3
10.1
C610.1
10.1
&
|
^
~
<<
>>
16
2intshortlongunsigned
3
(!)?(~)(<<)(>>)(&)(^)(|)?&&||?
1 (&)
,&”110
1
2
2 |
|”110
10.2 C
#include "stdio.h"
main()
{ int ka[10]{23142431465533682740}
for (k0k10k)
printf("%5d"a[k])
printf("\n")
for (k0k10k)
a[k]a[k]|0x01
for (k0k10k)
printf("%5d"a[k])
printf("\n")
}
3 (^)
,^” 10
10110
20
3
4 (~)
,~”0110
,”
6 (>>)
,>>”01
0
0011 0
10.2
C
struct
{ }
1unsigned
2
3
4
5
10.3
10.3 C
mnn0m
nn0m|n|
mn
sizeofk
mnknmknn
mnknmknn
C
#include "stdio.h"
main()
{ unsigned m
int n
printf("input m:")
scanf("%x"&m)
printf("input n:")
scanf("%d"&n)
if (n0)
printf("moveright%x\n"moveright(mn))
else
printf("moveleft%x\n"moveleft(mn))
}
moveright(unsigned mint n)
{ unsigned z
int k
k8*sizeof(unsigned)
z(m>>n)|(m<<(kn))
return(z)
}
moveleft(unsignedmint n)
{ unsigned z
int k
k8*sizeof(unsigned)
z(m<<n)|(m>>(kn))
return(z)
}