Today, I finally talked about the scope of the C language. "Function" said that everything in the C language is really true (maybe, I don't know). Many books have said that the function is the C language, that is, the function is constituted in C language. Look at the following program: main () {Printf ("Hello World");} main () is the most special function in the C language, which is the key to constitute the entire program. In the C compiler, you first have to find out that this master is starting to perform compilation, well, said some books. Now let's take a look at how the function in the C language is. If we don't mean from the foundation. Then we will say from another characteristics of the function. "Recreasing function" believes that many people know this, I have seen the old turtle, I should know the first recursive procedure of his classic: int abc (int N) { INT S; if (n> 1) s = N * ABC (N-1); Else S = 1; Return (s);} It is easy to see from this source program to have a function with his name, So after we see a function that calls yourself in a function is the recursive function. And we look at a recursive function, it is mainly to see if it is a return condition, just like a dark and deep cave. We must go back before you go to the end, even more deeper must return! So we determine if a recursive function is established and often seeing its return condition. As for the source program above, I don't want to say more, I should understand it. Here, look at another topic that uses the recursive function, it is the Noko Tower (there is also a book in the old man).
#include void move (char x, char y) {printf ("% c ->% c / n", x, y); void hanoi (int N, char one, char two, char {IF (n == 1) Move (One, Three); Else {Hanoi (N-1, One, Three, Two); Move (One, Three); Hanoi (N-1, Two, One, Three }} Main () {INT M; Printf ("INPUT The Number of Diskes:"); Scanf ("% D", & M); Printf ("THE Step to Moving% 3D Diskees: / N", M) Hanoi (M, 'A', 'B', 'C');} / * Operations are as follows: Input the Number of Diskees: 3 Enter The Step To Moving 3 Diskes: a -> C A -> B C -> B A -> C B -> A B -> C A -> C book saying Hanoi (N-1, One, Three, Two); is N of "One" -1 moves towards "TWO", then move (one, three); then Hanoi (N-1, Two, One, Three) is moved to "THREE" on "TWO"; | h (2, 1, 3, 2) | h (1, 1, 2, 3) => Move (1, 3) <----- 1 ------ | | Move (1, 2 <----- 2 ------ | | h (1, 3, 1, 2) => Move (3, 2) <----- 3 ------ | Move 1, 3) <----- 4 ------ | h (3, 1, 2, 3) | | h (1, 2, 3, 1) => Move (2, 1) <- ---- 5 ------ | H (2, 2, 1, 3) | Move (2, 3) <----- 6 ------- | | h (1, 1 , 2, 3) => Move (1, 3) <----- 7 ------ | * / Note Or above is written by a netizen online, not what I wrote. The most different from Norhan Tower is that it has repeatedly called themselves, so it looks more complicated. At that time, I was watching this program and I didn't understand the old half-day. It is best to see a friend on the Internet saying that he really took some dishes. I tried it. Later, I also I tried to see, the effect is really good (I certainly don't have a stupid drink, write big, middle, small) with my disc, you don't know how to visit. In addition, I saw this picture. I am also more clear, I want to thank the netizen, do you say it? This program must be slowly understood, I wish you all an early understanding. Recurrent function I can't say anything because I don't know much, now come to see another content of the function, is the parameter call of the function. I will give a program first: int ABC (int A, int b) {a = a = b; return (a b);} main () {int XY [] = {3,5}; int S; s = ABC (XY [0], XY [1]);} In the shape of XY [0] and XY [1], the point to say is different from other advanced languages, The function call of the C language is unidirectional.