Questions |
Explanation |
|
The question is wrong. It is: youyuan YunAlgorithmOperator, which refers to the operator in the form of friends. Two Methods of Operator Overloading: member functions and friends If a member function has a hidden parameter during overload * This, the answer is C. If it is a friend, no default parameter exists. The answer is B. |
|
This error is mainly because it is not necessary to see clearly. Functions are mainly the return values of function bodies. |
|
Array definition and instantiation: This topic defines a two-dimensional array, which is X [0] and X [1. So X [1] is the 4 address. * X [1] indicates 4. In addition, for the initialization method in the definition of X [] [] Two-dimensional, refer Http://see.xidian.edu.cn/cpp/biancheng/view/152.html |
|
Evaluate the meaning of escape characters. \ 0, \ t, \ n, and so on are called escape characters, because the subsequent characters are not their original ASCII characters. However, another test is that the string ends with \ 0. Therefore, strlen does not detect the character length after \ 0. The size of the St is the size of the array 20. |
|
Or the question of the string: What is the length of a character? I think the answer is wrong, Of course, I use sizeof to get 4. Use strlen to get 3. We can know that sizeof indicates that the length of char * includes \ 0. Strlen ends at \ 0 and does not include it. |
|
This question has been encountered during the interview. Below are several situations: Int arr [3] 1. pointer Array Int * P [3] This defines an array of pointers. The elements are three pointers pointing to three int-type addresses respectively. EquivalentInt * (p [3]) 2. pointer INT (* P) [3] Defines a pointer pointing to the address of an array with three elements For example, P = & arr; |
|
Operator priority: In my opinion, it is hard to remember, but generally it should be remembered that: for example, the assignment operator, &, |, and so on have a lower priority. () The highest priority. Http://en.cppreference.com/w/cpp/language/operator_precedence For more information about the priority table, see. Question :! The priority is higher than &, so ,! If X is true, then calculate the true value following. In addition, for & and |, there is also the ability of the compiler to optimize computing. For example, if the value before & is false, there is no need to calculate the subsequent value. In fact, the compiler works like this. The following questions |
|
We know that () has the highest priority, = the value assignment operation is relatively low, and the comparison operation is relatively high. So, & the previous value Is (M = A> B) The first step is to calculate the order.> the value is higher than the value assignment, so m = 0 is obtained. Then it is the return value after the value assignment, Int operator = (INT) returns the value of the value, which is 0. Therefore, the value of the entire expression is 0 and the subsequent value is not executed. |