#include <stdio.h>
#include <string.h>
void printit(char line_of_char[], int index);
int main()
{
char line_of_char[80];
int index = -1;
 strcpy(line_of_char, "1234567890");
 printit(line_of_char, index);
 return 0;
}
void printit(char line_of_char[], int index)
{
 if(line_of_char[index])
 {
  index++;
  printf("+%c", line_of_char[index]); /*how come this is not being
printed after "-" was printed*/
  printit(line_of_char, index);
  printf("-%c", line_of_char[index]);
 }
}
o/p=+1+2+3+4+5+6+7+8+9+0+--0-9-8-7-6-5-4-3-2-1
can anyone explain how this program is working( why +-- between two
zero's  and how second printf is returning value in recursion)

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to