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 |
What is the use of pointers in C?
0 Answers Impetus, Motorola, Tavant Technologies, Virtusa,
I have written a pro*C program to fetch data from the cursor. where in i have used the concept of BULK FETCH.... each FETCH statement is taking lots of time to fetch specified number of rows at...
what is difference between C and C++
What is the difference between printf and scanf )?
1)what are limitations for recursive function? 2)write a program to read a text file and count the number of characters in the text file
What is difference between union and structure in c?
What is the role of && operator in a program code?
marge linklist
pgm to reverse string using arrays i.e god is love becomes love is god) (assumption:only space is used for seperation of words) no addtional memory used.i.e no temporary arrays can used.
how we do lcm of two no using c simple if while or for statement
dibakar & vekatesh..uttejana here..abt ur reply for in place reversal of linked list..wats p stands for there?
What is a pointer value and address in c?