Both of them look at the code, and then find the error in the code and make an explanation.
Topic One
int array[] = {1,2,3,4,5,6}; #define ELEMENTS (sizeof (array)/sizeof (array[0)) int main () { int d =-1, x; for (int i = D; i< elements-1; i++) x = array[1]; cout<< x;}
misunderstanding: This article mistakenly thought #define
that part of the error. Think elements can not find the length of the array, the result will be 1. There is a misunderstanding here, that is, when the sizeof array, the total size of the array is returned or the size of the head pointer.
The right answer: There are eyes who can make the answer. The error is that when looping, the i<elements-1
return value will be false and the assignment operation in the loop body is not performed. The reason for this is that the return value of the sizeof operator is size_t, which is generally the unsigned int type. So, the last X is output without initialization.
Topic Two
The topic is too long, too lazy to fight.
The point is that
char* localtime (char* filename) { ... Char buffer[120]; ... return buffer;}
This is just one of the points of attention.
I failed ...
Digital Video 2015 school recruit written test C + + Simple Summary