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

 Print  |  
Question:  Recursive Function

Answer: 1. Find output for following recursive function :

int main()
{
int i=32242,j=find(i);
}
int find(int j)
{
if(j)
{
j = j%10 + find(j/10);
printf(" %d ",j);
}
return j;
}

2. What is the problem with following code :

char* AddnewlinetoString(char *s)
{
char buffer[1024];
strcpy(buffer,s);
buffer[strlen(s)-1] = 'n';
return buffer;
}
 


August 08, 2008 04:43:44 #1
 windows_pal   Member Since: August 2008    Total Comments: 3 

RE: Recursive Function
 
 1.The answer is:24223
     

 

Back To Question