someone
someone

Reputation: 19

What is the difference between struct node * arr[] and (struct node)* arr[]?

First option works fine but when I opted for second option { (struct node)* arr[] } I got an declaration error. Please make me know where am I wrong?

Upvotes: 0

Views: 311

Answers (1)

Travis
Travis

Reputation: 2188

In this case, the compiler interprets the parentheses to denote the cast operator. Basically, parentheses are never needed in a declaration like this, so don't use them--they will be interpreted as something else.


EDIT:

Parentheses may be needed in some declarations, like a function signature for a callback parameter.

Upvotes: 1

Related Questions