168k views
5 votes
Not all arithmetic operations may be performed on pointers. For example, you cannot ________ or ________ a pointer.

A) multiply, divide
B) add, subtract
C) +=, -=
D) increment, decrement
E) None of these

1 Answer

6 votes

Final answer:

In programming, specifically with C/C++ pointers, you cannot multiply or divide a pointer; hence the correct answer is A) multiply, divide.

Step-by-step explanation:

In the context of programming, specifically when dealing with C or C++ pointers, certain arithmetic operations are not applicable. Specifically, you cannot multiply or divide a pointer. Therefore, the correct answer to the question is A) multiply, divide. Pointers can be incremented and decremented, which effectively moves the pointer to point to the next or previous memory location, respectively. One can also add or subtract an integer to a pointer, which moves the pointer by a multiple of the size of the data type it points to. However, using multiplication or division on pointers does not have a logical meaning in the context of memory address manipulation, therefore it is not allowed.

User Dave Burt
by
7.3k points