2

I was studying c programming book R&K but can't understand difference between void **lineptr and (void** )lineptr and can we use them instead of each other?

Deepesh Choudhary
  • 621
  • 1
  • 8
  • 17
arianpress
  • 369
  • 5
  • 14
  • 1
    They aren't remotely similar - what scenario are you trying to use either/both in? – Oliver Charlesworth Apr 30 '17 at 16:05
  • Although the answer is perhaps clear in this case, generally context is everything; you should include code examples of real code where you have seen these. I suspect that had you dine that the difference would have been clear to you in any case. – Clifford Apr 30 '17 at 16:14
  • Check [this](http://stackoverflow.com/questions/859634/c-pointer-to-array-array-of-pointers-disambiguation) for the disambiguation of syntax toward pointers. This is a bit different but it'll explain a lot. – Archmede Apr 30 '17 at 17:47

1 Answers1

3

The first is a declaration of a variable lineptr of type void**, the second is a type cast of the existing variable lineptr to the type void**.

So, no, they are not interchangeable and are semantically different.

Paul Ogilvie
  • 24,620
  • 4
  • 19
  • 40
Clifford
  • 82,791
  • 12
  • 81
  • 153