2 * This simple classical example of recursion is useful for
3 * testing stack backtraces and such.
10 /* VxWorks does not supply atoi. */
17 while (*z
>= '0' && *z
<= '9')
18 i
= i
* 10 + (*z
++ - '0');
22 /* I don't know of any way to pass an array to VxWorks. This function
23 can be called directly from gdb. */
32 main (2, argv
, (char **) 0);
38 #endif /* ! vxworks */
44 main (int argc
, char **argv
, char **envp
)
47 main (argc
, argv
, envp
)
53 printf ("%d\n", factorial (1)); /* commands.exp: hw local_var out of scope */
56 printf ("usage: factorial <number>\n");
59 printf ("%d\n", factorial (atoi (argv
[1])));
66 int factorial (int value
)
68 int factorial (value
) int value
;
74 value
*= factorial (value
- 1);
78 } /* commands.exp: local_var out of scope */
This page took 0.031514 seconds and 4 git commands to generate.