GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Tech FAQs  >  Programming  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 9 of 92    Print  
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?

  
Total Answers and Comments: 7 Last Update: February 12, 2007     Asked by: M.srilatha 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
December 06, 2006 07:55:53   #1  
cpradip        

RE: Q1 How to swap Low-order byte and high order byte...

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.


 
Is this answer useful? Yes | No
December 07, 2006 06:42:05   #2  
Vijaya kumar V r        

RE: Q1 How to swap Low-order byte and high order byte...

Then answer is 

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


 
Is this answer useful? Yes | No
December 08, 2006 10:58:35   #3  
ragavendar        

RE: Q1 How to swap Low-order byte and high order byte...
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.
 
Is this answer useful? Yes | No
January 10, 2007 02:34:48   #4  
pavankishore Member Since: November 2006   Contribution: 6    

RE: Q1 How to swap Low-order byte and high order byte...

#include<stdio.h>

main()

{

int x=24;

x=x%10*10+x/10;

printf("%d",x);

}


 
Is this answer useful? Yes | No
January 31, 2007 02:34:31   #5  
malaram Member Since: January 2007   Contribution: 6    

Re:Q1. program to print the numbers from 1 to 100 without using any condition checking
#include#includemain(){static int n=1;print(n);int print(int n){printf("%d",n);}
 
Is this answer useful? Yes | No
January 31, 2007 02:37:06   #6  
malaram Member Since: January 2007   Contribution: 6    

RE: Q2.
#include#includemain(){int print(int n){printf("%d",n);n++;}static int n=1;print(n);}
 
Is this answer useful? Yes | No
February 12, 2007 05:00:36   #7  
rameshwar83 Member Since: February 2007   Contribution: 5    

RE: Q2 how to print number from 1 to 100 without using condition checking ...
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
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape