Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8482531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:51:13+00:00 2026-06-10T19:51:13+00:00

Possible Duplicate: What is really happening in this code? in this problem i cant

  • 0

Possible Duplicate:
What is really happening in this code?

in this problem i cant apply my concepts of recursion

#include<stdio.h>
count(int); 
main()
{
  int x=4;
  count(x);
  return 0;
 }
 count(int n)
 {
   if(n>0)
   { 
     count(n-1);
     printf("%d",n);
     count(n-1);
   }
  }

when we run the program count(4),count(3),count.....count(0) is stored in stack…but when count(0) is called and the if condition is false..then where does the control go? please if anyone can explain with the help of a diagram showing various function calls.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:51:14+00:00Added an answer on June 10, 2026 at 7:51 pm

    can you try the following piece of code.

    #include<stdio.h> 
    count(int);  
    int  main() 
    { 
        int x=4; 
        count(x); 
        return 0; 
    } 
    
    int count(int n) 
    { 
        if(n>0) 
        {  
            printf("%d",n); 
            return count(n-1);
        }
        else
        {
            printf("%d",n); 
            return n; 
        } 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: What is recursion really and explain the output of this program? What
Possible Duplicate: Can main function call itself in C++? I found this problem very
Possible Duplicate: Is JavaScript’s math broken? This seems really stupid, but when running this,
Possible Duplicate: Property Declaration and Automatic Backing Storage Allocation I'm really confused about this
Possible Duplicate: Arguments in @selector This is probably a really simple question, but I
Possible Duplicate: Get selected element's outer HTML I suspect this is a really stupid
Possible Duplicate: Reading in a text file in iOS This is a really dumb
Possible Duplicate: Do I really need to do mysql_close() Maybe the first question to
Possible Duplicate: How to catch exceptions I have not really had to use try
Possible Duplicate: What does 'foo' really mean? I hope it is not the most

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.