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

pointer_variable=(typecasting datatype*)malloc(sizeof(datatype)); This is the syntax for malloc?Please explain this,how it work with an example?

2 Answers   eClerx, Excel, kenexa,


What is the difference b/w Structure & Class?

3 Answers  


Rapunzel walks into the forest of forgetfullness. She meets a Lion who lies on Monday Tuesdays and Wednesdays and meets a rabbit who lies on Thurs fridays and saturdays . On that day both say that "I lied yesterday". What day is it .

3 Answers   TCS,


Explain what is the best way to comment out a section of code that contains comments?

0 Answers  


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

0 Answers  






can anyone please tell me wat is backlogs... i was looking for the job openings where i read this.. eligibility criteria minimum 70% in degree without backlogs. is that arrear.. if so is it standing arrear or history of arrears... please help me...

11 Answers   CTS, Indian Navy, L&T, Microsoft, SSB, TCE, TCS,


any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above

0 Answers  


struct screen_pos{ int row, col } ;move_right(cursor)struct screen_pos *cursor;{ cursor.col++; } /* This statementhas a syntax error */What is the correct statement a) cursor.col = cursor.col + 1; b) col.cursor++; c) *cursor.col++; d) pointer

0 Answers  


Can you subtract pointers from each other? Why would you?

0 Answers  


what is the hexidecimal number of 4100?

16 Answers   Google,


what is the difference between #include<stdio.h> and #include"stdio.h" ?

6 Answers   TCS,


Determine if a number is a power of 2 at O(1).

2 Answers  


Categories