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
code for quick sort?
what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)
What is c standard library?
Why does everyone say not to use gets?
What is the difference between array_name and &array_name?
What does p mean in physics?
What library is sizeof in c?
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
main(){char *str;scanf("%s",str);printf("%s",str); }The error in the above program is: a) Variable 'str' is not initialised b) Format control for a string is not %s c) Parameter to scanf is passed by value. It should be an address d) none
What is a double c?
Explain what are its uses in c programming?
What is double pointer in c?
Define Spanning-Tree Protocol (STP)
What are the scope of static variables?
Why is c called a structured programming language?