Q:

IS VOID POINTER ARITHMETIC A VALID ONE? WHY?

belongs to collection: C INTERVIEW QUESTIONS AND ANSWERS

0

IS VOID POINTER ARITHMETIC A VALID ONE? WHY?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Arithmetic operation on void pointer is not valid one. Void pointer is a generic pointer. It is not referring int, char or any other data type specifically. So, we need to cast void pointer to specific type before applying arithmetic operations.

Note:

  • Pointer arithmetic itself is not valid one. Pointer addition, multiplication and division are not allowed as these are not making any sense in pointer arithmetic.
  • But, two pointers can be subtracted to know how many elements are available between these two pointers.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C INTERVIEW QUESTIONS AND ANSWERS

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
WHAT IS THE DIFFERENCE BETWEEN NULL AND ZERO?... >>
<< IS POINTER ARITHMETIC A VALID ONE? WHICH ARITHMETI...