how to set Nth bit of a variable?
Answer / kirankumaryakkala
ex: int res=16, temp=1,n;
printf("enter the Nth bit no");
scanf("%d",&n);
temp=temp<<n; //leftshift to ntimes
res=res|temp; //bitwise OR
printf("setted nth bit of res %d",res);
| Is This Answer Correct ? | 9 Yes | 4 No |
What is an volatile variable?
How do you determine a file’s attributes?
Is it possible to use curly brackets ({}) to enclose single line code in c program?
Why c is a procedural language?
What is chain pointer in c?
What is sizeof in c?
What is use of integral promotions in c?
What is the difference between formatted&unformatted i/o functions?
What are derived data types in c?
How do I create a directory? How do I remove a directory (and its contents)?
struct node {struct node*temp,*new} prinf("%d",sizeof(struct node));
What are the uses of pre-processor directives?