Q1 How to swap Low-order byte and high order byte in an integer without using temporary variable ?Q2 write a program to print numbers from 1 to 100 without using any condition checking ?Q3 If we develop a project in C,then how can we create an .exe file of it?Q4 Write a program which accepts a filename as a command like argument and reverse the contents of the file (i.e firs character becomesthe last character of the file and so on)input: the program takes the file name whose content should be reversed output: the program reverse the contents of the file Q how can i call a function ,given its name as string?

Showing Answers 1 - 24 of 24 Answers

cpradip

  • Dec 6th, 2006
 

wont this work

i = ((i<<4)&255) | ((i>>4)&255); assuming that the data type of the number to hold is 8 bits and positive integers.

Vijaya kumar V r

  • Dec 7th, 2006
 

Then answer is 

i = ( ((i<<8)&0xFFFF) | ((i >>8)&0xFFFF))

  Was this answer useful?  Yes

ragavendar

  • Dec 8th, 2006
 

i = ( ((i<<8)&0xFFFF) | ((i >>8)&0xFFFF))(i>>8) would screw bigtime if i is a negative number. While right shifting, the vacated bits are not filled with zero but with the sign bit.

  Was this answer useful?  Yes

As this code have been posted for above problem .........#include#includemain(){int print(int n){printf("%d",n);n++;}static int n=1;print(n);}can anyone plz explain me how this code is working............my email id is rameshwar_pratap@yahoo.com

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions