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
  • 660
  • 1
  • 8
  • 17
arianpress
  • 456
  • 1
  • 6
  • 16
  • 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
  • 25,048
  • 4
  • 23
  • 41
Clifford
  • 88,407
  • 13
  • 85
  • 165