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
How can I find the modification date of a file?
What is the difference between union and anonymous union?
Explain what is the benefit of using #define to declare a constant?
1) write a program to generate 1st n fibonacci prime numbers using Nested if 2) write a program to generate twin prime numbers from m to n using nested if 3) write a program to check whether a given integer is a strong number or not using nested if 4) Write a program to generate prime factors of a given integer using nested if 5)write a program to generate prime numbers from m to n using nested if 6)write a program to generate perfect numbers from m to n using nested if 7)write a program to generate the pallindromes from m to n using neste if 8)write a program to generate armstrong numbers from m to n using nested if 9)write a program to generate strong numbers from m to n using nested if
Explain how can you restore a redirected standard stream?
Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
What is meant by type casting?
What are the parts of c program?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
Is there a way to jump out of a function or functions?
What is the difference between c and python?
What is a pointer and how it is initialized?
What does int main () mean?
What is character constants?