Write a macro to set the nth bit ? Click for Solution |
-
Warning: Illegal string offset 'name' in /home/prepdo6/gpl4you/discussquessub.php on line 681
A #define set(x) pow(2,x) void main() { int num,x; num=num|set(x); }
View all 6 commentsCpjJwWHV your program will then become.......................
#define set(x) pow(2,x)
void main()
{
int num,x;
num=num|(int)set(x);
}14 years ago CpjJwWHV your program will then become.......................
#define set(x) pow(2,x)
void main()
{
int num,x;
num=num|(int)set(x);
}14 years ago CpjJwWHV yes.i agree wid subhash. 14 years ago CpjJwWHV yes u should write num=num|(int)set(x); 14 years ago CpjJwWHV isnt it should be ,, pow(2,(x-1))
becoz setting nth bit, let 4th bit means 2^3,
as bit starts with 2^0 , 2^1, 2^2, and 4th bit 2^314 years ago
Explore
- GPL4you
- Home
- Prepdoor - Online Mock Test
- About
- FAQs
- Contact
- Contact Us
© 2011 - gpl4you | All Rights Reserved.