View Single Post
Old Oct 19th, 2006, 2:14 AM   #7
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 763
Rep Power: 3 Jimbo is on a distinguished road
Since we seem to be comparing implementations... from one of my entries to the "500 ways to program 1-10" thread:
unsigned long A(unsigned long m, unsigned long n)
{
  if(!m)
    return n+1;
  if(!n)
    return A(m-1, 1);
  return A(m-1, A(m, n-1));
}

[edit:] As to your code, couple stylistic issues:
- you forward declare the function, then immediately define it. You could take the declaration out.
- you use local variables whose values are just the same as your parameter values. No need for those either.
__________________
<insert disclaimer here>
<insert shameless plug for Visual Studio here>

Last edited by Jimbo; Oct 19th, 2006 at 2:27 AM.
Jimbo is offline   Reply With Quote