Write a function that accepts two numbers,say a and b and
makes bth bit of a to 0.No other bits of a should get
changed.

Answers were Sorted based on User's Feedback



Write a function that accepts two numbers,say a and b and makes bth bit of a to 0.No other bits of..

Answer / sandeep ambekar

Macro to Set a particular Bit..
#define SetBit(x,y) x | 0x1<<y

Macro to Clear a particular Bit..
#define ClearBit(x,y) x & ~(0x1<<y)

Is This Answer Correct ?    5 Yes 2 No

Write a function that accepts two numbers,say a and b and makes bth bit of a to 0.No other bits of..

Answer / ramkumar

int func(int a,int b)
{
int ans;
ans = a - 2^b;
return ans;
}

Is This Answer Correct ?    0 Yes 7 No

Post New Answer

More C Interview Questions

How macro execution is faster than function ?

0 Answers   Wipro,


Explain about the constants which help in debugging?

0 Answers  


What does == mean in texting?

0 Answers  


Write a program to implement queue.

0 Answers   Aricent,


What are the 4 types of unions?

0 Answers  


What could possibly be the problem if a valid function name such as tolower() is being reported by the C compiler as undefined?

0 Answers  


At a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets with these names could be kept in that shelf as in this example: bottom of shelf ---> [AAAJKRDFDEWAAYFYYKK]-----Top of shelf. All these packets are to be loaded on cars. The cars are lined in order, so that the packet could be loaded on them. The cars are also named [A, B, C, D, E,………….]. Each Car will load the packet with the same alphabet. So, for example, car ‘A’ will load all the packets with name ‘A’. Each particular car will come at the loading point only once. The cars will come at the loading point in alphabetical order. So, car ‘B’ will come and take all the packets with name ‘B’ from the shelf, then car ‘C’ will come. No matter how deep in the shelf any packet ‘B’ is, all of the ‘B’ packets will be displaced before the ‘C’ car arrives. For that purpose, some additional shelves are provided. The packets which are after the packet B, are kept in those shelves. Any one of these shelves contains only packets, having the same name. For example, if any particular shelf is used and if a packet with name X is in it, then only the packets having names X will be kept in it. That shelf will look like [XXXXXXX]. If any shelf is used once, then it could be used again only if it is vacant. Packets from the initial shelf could be unloaded from top only. Write a program that finds the minimum total number of shelves, including the initial one required for this loading process.

0 Answers   Infosys,


Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?

0 Answers  


How can a number be converted to a string?

1 Answers  


write a program to read a number and print in words that is in sentence for example 21,219 then output is "twenty one thousand and two hundred nineteen" by using only control flow statements (only loops and switch case )?

1 Answers   TCS,


diff. between *p and **p

3 Answers  


write a c program that if the given number is prime, and their rearrangement(permute) of that number is also prime. Ex: Input is "197" is prime Output: 791,917,179 is also prime. Please any one tell me tha code for that

3 Answers  


Categories