how to TOGGLE Nth bit of variable in a MACRO



how to TOGGLE Nth bit of variable in a MACRO..

Answer / kiran kumar yakkala

#define ~toggle(val,n) var^=1<<n


Is This Answer Correct ?    8 Yes 2 No

Post New Answer

More C Interview Questions

#define d 10+10 main() { printf("%d",d*d); }

6 Answers  


class foo { public: static int func(const char*& p) const; }; This is illegal, why?

8 Answers   Google,


Explain goto?

0 Answers  


What is c system32 taskhostw exe?

0 Answers  


What are types of preprocessor in c?

0 Answers  


What are the types of data types and explain?

0 Answers  


There is a 100-story building and you are given two eggs. The eggs (and the building) have an interesting property that if you throw the egg from a floor number less than X, it will not break. And it will always brake if the floor number is equal or greater than X. Assuming that you can reuse the eggs which didn't broke; you got to find X in a minimal number of throws. Give an algorithm to find X in minimal number of throws.

5 Answers   Yahoo,


What's the best way to declare and define global variables?

7 Answers  


what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; a.9 b.8 c.6 d.7

4 Answers   TCS,


#include<stdio.h> int main() { int a[3][3][2]= {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}; printf("%d\n",*(*(*a+1)); return 0; } What will be the output of the above question? And how?

1 Answers   Groupon,


What is the difference between strcpy() and memcpy() function in c programming?

0 Answers  


which types of data structure will i use to convert infix to post fix???

5 Answers   IIT,


Categories