HITEQUEST
technical interview Q & A for high-tech professionals
 
 
Interview Questions
Electronics Hardware
Computer Software
General questions
Brain teasers

Resources
Resume and interview
How to get a job in Silicon Valley
How much are you worth on market?
Do you need an agent?

Break time stories
Tomato company

About Hitequest
About Hitequest
Join us
Home page

 
 
 
 
 
 
   

 
=Computer Software Questions=

     
   

Q:
Write a function to reverse the words in the sentence, for example "This is a string " becomes "string a is This".
 
 
 
 
 
 
 
 

A: anony
 
  A straightforward solution: split the string, get pointer to each word (strtok function will work), copy words in a reverse order into another string.
 
 
 
 

A: Tanit

	
SimpleLogic(char myStr[]) // pass the string 
{ 
char *t=myStr; 
while(*t) 
if(*t==' ') 
*t++='\0'; 
else 
++t; 

--t; 

while(t>myStr) 
if(*t=='\0') 
--t; 
else 
printf("%s\n",(t-- + 1)); 


printf("%s",myStr); 
}