This is not even "valid" code (It would be basically valid, 20 years ago, when variables without type were assumed to be ints).
/*int*/ x(/*int*/a,/*int*/ b){
float *a,*b;
while(*a++ = *b++);
}
In the following, I will assume, that a and b are int*
(At least in the parameters)
This is undefined behavior.
float *a,*b;
shadows the variables, that were given to it.
These both float pointers are uninitialized (=They can have every value possible, an access will crash the program)
In the while loop, you are incrementing uninitialized pointers. This may lead to e.g. crashes.
This method is copying value for value, as long as *b
is non-zero.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…