Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Reverse the bit order in a single macro.
eg. i/p = 10010101 --> o/p = 10101001

Answers were Sorted based on User's Feedback



Reverse the bit order in a single macro. eg. i/p = 10010101 --> o/p = 10101001..

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

Reverse the bit order in a single macro. eg. i/p = 10010101 --> o/p = 10101001..

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

Post New Answer

More C Interview Questions

Explain is it valid to address one element beyond the end of an array?

0 Answers  


Which is better oop or procedural?

0 Answers  


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(); }

4 Answers   CTS, Oracle,


What is the main difference between calloc () and malloc ()?

0 Answers  


What are the average number of comparisons required to sort 3 elements?

2 Answers   DRDO,


What is the difference between ‘g’ and “g” in C?

1 Answers  


Software Interview Questions

1 Answers   CAT,


What is variable declaration and definition in c?

0 Answers  


How can we open a file in Binary mode and Text mode?what is the difference?

1 Answers   PanTerra,


What is a struct c#?

0 Answers  


Is null equal to 0 in sql?

0 Answers  


List some basic data types in c?

0 Answers  


Categories