Today is the first day, finally there is a chance to hear the teacher's class, I think he is better than the old man, although I have never heard of the old man's class, but I believe in most The school's human class C language is the "C program design" in the old pool. The benefits of this book are much, the most important point is to illustrate some concepts with vivid examples, but it is a bit of a bad place. The topic of research. I know a "C language design tutorial" translated by the mechanical industry, this book has a large number of instance exercises, and it is around life. Learning and fun, I am having a few particularly attracting my topics when I am watching this book! The book is introduced here, or it is still going back to the course today.
Today, because of the first day, the teacher is still not very clear about our bottom. It is because we have been fully studying before, so I have to touch it. At first, he directly introduced the first question of the afternoon of the upper programmer exam, which is a programming filling question. as follows:
Int strcmp (char * s, char * t)
{
While (* S && * T && _______)
{
S ; T ;
}
Return ________;
}
This is the character comparison function in the C language character function library. At the time, I thought of a way, the first time because everyone didn't have a problem, * s and * t these two are maintained for logic. It shows that this storage unit uses characters. Everyone knows that there is no string in the C language. Only the character number, '/ 0' this symbol is used to indicate that this character number is ended, here is a new The concept is going to talk, it is true in C language logic, then '/ 0' this symbol is zero. So fill in this air, there should be no more difficult, follow, there is a condition to exit the loop, because it is more small, as long as you keep, continue, so the conditions can also be written out * s == * t . As for the second question, my thinking was set in the conditional operator, because the return value is three kinds, greater than returning positive, equal to returning zero, less than returning negative numbers. I know that these three may be filled with the conditional operator. I at the time is like this * s == * t? 0: * s> * t? 1: -1, this is not very long, actually My answer I don't know if it is right, but the real answer is * s - * t. Do you know why? At that time, I was scared for a while, because I really thought that it was a result (using the ACSII code), * s - * t, if the S-pointer is pointed, if it is of course positive Number, like other principles, this is no longer detailed.
In addition to quoting this question, I have said a lot of basic knowledge, and I will introduce us a pointer in more detail, hehe! Why did the teacher say that it is always clear that if you can teach a lot, you can take a lot of detours. Forget it, say these words are useless, only now you can learn well. Everyone is the foundation of each pointer. It is important to mention the teacher today to repeat the concept that the pointer is a variable to the address.
Ok, come here today.