how to set Nth bit of variable by using MACRO
Answer Posted / kirankumaryakkala
#define set(val,n) val|=1<<n //do left-shift then bitwise OR
logic is val|=1<<n
means,
first shift the value 1 to ntimes and do the bitwise or with
value.
u will get the answer
Is This Answer Correct ? | 30 Yes | 6 No |
Post New Answer View All Answers
What the different types of arrays in c?
What are the advantages of using linked list for tree construction?
Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.
How to write c functions that modify head pointer of a linked list?
What is variable in c example?
What is the difference between new and malloc functions?
Write a program to print "hello world" without using a semicolon?
Discuss the function of conditional operator, size of operator and comma operator with examples.
Is a pointer a kind of array?
How will you write a code for accessing the length of an array without assigning it to another variable?
Which of these functions is safer to use : fgets(), gets()? Why?
What is operator precedence?
What is sizeof in c?
What are c preprocessors?
Why do we need a structure?