Bitwise operator
1:
#include <stdio.h>
///bitwise operator:
int main()
{
int a,b;
a=5;b=6;
printf("%d %d %d",a&b,a|b,a^b);
return 0;
}
output:4 7 3
2:
#include <stdio.h>
///left shift -right shift
int main()
{
int a;
a=3;
printf("%d %d",a<<1,a>>1);
return 0;
}
output: 6 1
3:
#include <stdio.h>
///conditional operator:
int main()
{
int a,b;
a=5;b=10;
(a<b)? printf("%d",a) : printf("%d",b);
return 0;
}
output: 5
No comments:
Post a Comment