Hi all I am very new to C and am using Sams Teach Yourself C in 21 days. I have come across a program in day 5 that has baffeled me. More specificaly, it is a recursive function that has confused me. The code is posted below. The book says that the function contiues to call itself until the if statement ( if a == 1) is true. To me, this seems likea typo in the book, and it wouldnt be the first one that I have come across. I say this because, if a does equal 1, then the function would return a value of 1, right? If this is indeed a typo, i would appreciate greatly if someone would explain how this function works for me. thanks a bunch))
Code:unsigned int factorial(unsigned int a) { if (a == 1) return 1; else { a *= factorial(a-1); return a; } }