vault backup: 2024-10-25 14:06:54
This commit is contained in:
parent
f5c0b5f1bf
commit
9269af0cdd
@ -9,7 +9,12 @@
|
|||||||
```c
|
```c
|
||||||
middle = (low + high) / 2
|
middle = (low + high) / 2
|
||||||
```
|
```
|
||||||
The above statement is illegal because you can't add an `int *` to an `int *`. It can be made legal by casting `low` and `high` to numbers, performing the operation, then casting to a pointer.
|
The above statement is illegal because you can't add an `int *` to an `int *`. The below operation is legal because you can perform pointer subtraction, and because `low` is defined on the left hand side of the equation, then adding a long to a pointer is valid.
|
||||||
```c
|
```c
|
||||||
middle = (int*) (((long) low + (long) high) / 2);
|
middle = low + (high - low) / 2;
|
||||||
|
```
|
||||||
|
|
||||||
|
3. What will be the contents of the `a` array after the following statements are executed?
|
||||||
|
```c
|
||||||
|
{1}
|
||||||
```
|
```
|
Loading…
Reference in New Issue
Block a user