how to set Nth bit of variable by using MACRO
Answer Posted / vikram
The above code is wrong it should be n-1 instead of n.
#include<stdio.h>
#define SET(val,n) (val|=1<<(n-1))
main()
{
int n = 256;
printf("%d",SET(n,1));
}
Is This Answer Correct ? | 13 Yes | 8 No |
Post New Answer View All Answers
What is a pragma?
can we have joblib in a proc ?
What is || operator and how does it function in a program?
What are terms in math?
What are the advantages of external class?
What is stack in c?
Is c object oriented?
What is c programing language?
What are all different types of pointers in c?
Explain what is the purpose of "extern" keyword in a function declaration?
What is int main () in c?
write a c program in such a way that if we enter the today date the output should be next day's date.
c program for searching a student details among 10 student details
What is the use of parallelize in spark?
Can we change the value of static variable in c?