The text before
Wake up early in the morning, outside the rain falling under the continuous, really comfortable beds, but I am not in bed brush weibo look small, so think of last night to download cattle attracts APP, hurriedly pulled out my big baby – upgrading to iOS11 kidney (guys, really suggest upgrading to 11, is not I said, speed a lot, Although there are a lot of bugs to fix, but really much faster, and feel the internal power Settings have been changed, more durable. Though it is the greatest tragedy in ugly many PS: ugly aesthetic good view from my sister), and then to brush a set of c + + interview questions, the basics haven’t seen for a long time, recently obsessed with algorithm and data structure, so the basic large parts of the brain has been occupied by pointer, c + + does well, check a lot behind himself, Finally write a strategy, welcome to taste, also please help me correct, after all, I am now a slapstick.
The body of the
1.
Alp is an array of Pointers that contain three Pointers to three strings. Alp [1] naturally points to “DEF” and puts puts. So no problem, it’s D
2.
This code actually written is not very suitable for reading, should have a better code specification, successively, nesting order is obviously excellent! If (a>b) and printf(“%d\n”,d); There is no master-slave relationship, that is, printf(“%d\n”,d); If (a>b) can change the value of d? And does it output itself? If (“%d\n”,d); printf(“%d\n”,d);
3.
I didn’t know that! So we’ll have to borrow the answer from the forum. Large file tablespaces can contain only one file, but files can be as large as 4G data blocks. Can contain only one file, but a file can contain more than one data file? I don’t know if this is the understanding)
4.
CcString1 = “No” and does not leave the Page Fault?? Cout <
else
cout<<ccString1;Copy the code
5. What is wrong with the passage?
In C/C++, sizeof() is an operator that determines the length of a data type or expression. On a 32-bit machine, all pointer variables take up 4 bytes of memory because on a 32-bit machine it’s 4 bytes by 8 bits per byte. On a 64-bit machine, Pointers take up 8 bytes of memory.
The next step is to determine the types of variables in parentheses, and then find out their lengths based on the results of table lookup. The comparison table is shown below
A: 8 B: 17 C: 1 D: 8Copy the code
6.
This don’t have much to say, I feel I do, all by the first, the macro I don’t remember to have such a big security hidden danger, the third, the macro is to program the readability, modifiability, fourth, macro definition for the improvement of operation efficiency in fact do not have what influence, just for seeing and convenient to modify! I am not quite clear, have not learned essence, should still be able to talk about slowly behind!
7. 【 答 案 】
In fact, it does, but it’s just not accessible. So we end up with three Pointers in B, and sizeof(B) is valid whether or not we can access them. 8 * 3 = 24 ~ ~
8. 【 答 案 】
This is relatively complicated. I was clear at that time, but it seemed that I made a mistake in judgment, and then I read one more number. Here is a detailed explanation.
int fun1(char s[], char a, int n)
{
int j;
j = n;
while (a < s[j] && j > 0) j--;
return j;
}Copy the code
This function is to return to the seventh in the s began to count, how many can satisfy the condition of no more than a first, say s is a character array, increasing a increasing in the sequence of the middle, began to find the first from a height of less than or equal to a character code value is returned, this is fun1 role, fun2 works in a similar way, to find it from below, Fun1 returns 5, fun2 returns 6. Am I stupid? Fun2 returns 6. Fun1 counts to 6!!
9.
I really got my head around this topic. First of all, the argument that f1 passes in has to be a pointer, so C is fine, and then with D, what I was thinking is, if it makes a difference, then of course you have to respect the parenthesis method that you originally defined. So unhesitatingly choose D now think, if with parentheses useless, with this parenthesis why, idle chicken son pain? As for the others, A needs to be parenthesized, B needs to pass in A pointer, don’t *!
10. 【 答 案 】
To be honest, THIS kind of topic I have never seen, also today’s first wave of cattle to see. Take your time from now on! For a 16-bit machine, char is 1 byte and int is 2 bytes. There are two rules for byte alignment in the structure:
- Data member self-alignment, that is, the start address of the data member is an integer multiple of the length of the data type
int
Type b can only go from 0,2,4… Wait for the address to start; - The total length of the structure is an integer multiple of the valid alignment value in the structure, which, if not explicitly specified, is the longest data member
(int b)
An integer multiple of the length;
According to the above two rules, draw a memory diagram. According to rule 1, int b starts at 2, and the total length of the structure is (1 + 1 + 2 + 1 = 5); According to rule 2, the total length of the structure should be an integer multiple of 2, so it should be 6. The two bytes highlighted in red represent wasted.
After the body
When I looked up, it was 10:30. Get up!!!!! But I was wondering, should I go on and write in such detail? It feels like a waste of time, but it’s a good summary, and a great benefit for future review. So hang in there. If it doesn’t work out. It again!