Thread: problem with printing elements of a array using recursion program

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    13

    problem with printing elements of a array using recursion program

    problem with printing elements of a array using recursion program
    Code:
    #include<stdio.h>
    void pa(int [],int,int);
    int main()
    {
    
    int a[14]={10,20,30,40};
     pa(a,0,3);
    }
    void pa(int a[],int lb,int ub)
    {
           if(lb==ub)
           printf("%d",a[lb]);
           else
           {
               printf("%d",a[lb]);
               pa(a,lb+1,ub);
           }
    }
    there is some problem with the above code.....please find where it went wrong.......
    Last edited by cooldude; 09-14-2009 at 11:21 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  2. printing array elements in ascending order
    By galmca in forum C Programming
    Replies: 29
    Last Post: 10-24-2004, 11:24 PM
  3. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM
  4. problem with printing a structed array using for loop
    By Prezo in forum C++ Programming
    Replies: 2
    Last Post: 09-15-2002, 09:00 AM
  5. problem with 2d array program.
    By Niloc1 in forum C Programming
    Replies: 1
    Last Post: 04-08-2002, 05:47 PM