Reverse the bit order in a single macro.
eg. i/p = 10010101 --> o/p = 10101001
Answers were Sorted based on User's Feedback
Answer / balaji ganesh
#include<stdio.h>
#define f(a) strrev(a)
main()
{
char c[20];
scanf("%s",c,printf("enter bit string;"));
printf("%s",f(c));
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / vishnu
with out using strrev
=======================
#include<stdio.h>
#include<conio.h>
int i ;
void binary(int retval[],int num)
{
int k;
while(num >1)
{
k = num;
num =num/2;
retval[i] = k%2;
i++;
}
retval[i] =1;
}
int main()
{
int num;
int bin[20];
scanf("%d",&num);
binary(bin,num);
for(num=i;num >=0;num--)
printf("%d",bin[num]);
printf("\n");
for(num =0;num<=i;num++)
printf("%d",bin[num]);
getch();
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Explain is it valid to address one element beyond the end of an array?
Which is better oop or procedural?
What is the output of the program #include<stdio.h> #include<conio.h> void main() {0 int i,j=20; clrscr(); for(i=1;i<3;i++) { printf("%d,",i); continue; printf("%d",j); break; } getch(); }
What is the main difference between calloc () and malloc ()?
What are the average number of comparisons required to sort 3 elements?
What is the difference between ‘g’ and “g” in C?
Software Interview Questions
What is variable declaration and definition in c?
How can we open a file in Binary mode and Text mode?what is the difference?
What is a struct c#?
Is null equal to 0 in sql?
List some basic data types in c?