Only legal pointer operations:
A. pointer + number → pointer
B. pointer − number → number
C. pointer + pointer → pointer
D. pointer − pointer → pointer
E. pointer − pointer → number
Choose the most appropriate answer from the options given below:
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: D. A, E Only
Explanation
Adding an integer to a pointer gives a pointer (A). Subtracting an integer from a pointer gives a pointer, not a number (B wrong). Two pointers cannot be added (C wrong). Subtracting two pointers into the same array gives an integer (the element distance), so E is correct and D is wrong.More Programming Languages and Computer Graphics questions
- Consider the operators used in C Programming given below: A. && B. += C. >> D. >= E. ?: Choose the correct order of precedence of the opera…
- Consider the conditional statement if (m == 20 − 10 || n > 10). The order of execution of the following operations is A. == B. − C. || D. >…
- Which of the following is NOT true about Global Variables?
- Arrange the 2-D viewing transformation pipeline. A. Convert world coordinates to viewing coordinates B. Map viewing coordinates to normaliz…
- The entire set of parameters, including the return address, that is stored for a procedure invocation is referred to as
- Consider the following statements:int x = 10, y = 15; x = ((x == y) ? (y + x) : (y - x)); What will be the value of x after executing these…