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

What is the use of parallelize in spark?

0 Answers  


How can we allocate array or structure bigger than 64kb?

2 Answers   CSC,


Go through this linked list concept.While traversing through the singly linked list sometimes the following code snippet "while(head != NULL)" is used and other times "while(head->link != NULL)"is used(Here head is the pointer pointing to the first node,node has two parts data part and link part).What is the difference between head != NULL and Head->link != NULL and in which situation are they used?

1 Answers   Oracle,


Is c dynamically typed?

0 Answers  


Explain #pragma statements.

0 Answers  






Is there anything like an ifdef for typedefs?

0 Answers  


void main() { int s[4][2]={ {1234,56},{1212,33},{1434,80},{1312,78} }; int (*p)[2]; int i,j,*pint; for(i=0;i<=3;i++) { p=&s[i]; pint=p; printf("\n"); for(j=0;j<=1;j++) printf("%d",*(pint+j)); } } while running this program it shows a warning-suspicious pointer conversion ie pint=p; my que is why should we assign the value of p to pint again.why cant we use it directly as *(p+j)..but if i use like tat the o/p is garbage value..

1 Answers  


I need a sort of an approximate strcmp routine?

0 Answers  


Why do we need a structure?

0 Answers  


main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); } what is the output?

10 Answers   Ramco,


15.what is the disadvantage of using macros? 16.what is the self-referential structure? 17.can a union be self-referenced? 18.What is a pointer? 19.What is the Lvalue and Rvalue? 20.what is the difference between these initializations? 21.Char a[]=”string”; 22.Char *p=”literal”; 23.Does *p++ increment p, or what it points to?

2 Answers   CTS,


What functions are used in dynamic memory allocation in c?

0 Answers  


Categories