1.

Which of the following returns a signed integer type on finding the difference between two pointers to elements in the same array?(a) __cptrdiff__(b) cptrdiff_t(c) __ptrdiff__(d) ptrdiff_tI had been asked this question at a job interview.My question is from Standard Definition in portion C Library of C

Answer»

Correct option is (d) ptrdiff_t

To EXPLAIN I would SAY: ptrdiff_t is used for POINTER ARITHMETIC and array indexing. Only pointers to ELEMENTS of the same array may be subtracted from each other.



Discussion

No Comment Found

Related InterviewSolutions