imdadable
imdadable

Reputation: 147

C array index in parentheses

I happened to see quantSpec[(1024)] in FDKAAC audio codec. It's written in C, C++.

What does the parenthesis mean? Is it not as same as quantSpec[1024]?

Upvotes: 4

Views: 370

Answers (2)

R Sahu
R Sahu

Reputation: 206747

Use of parentheses is necessary when you want to change the order of precedence of operations when evaluating an expression. Sometimes, especially in long expression in the conditionals of if and while statements, presence of parenthesis make the code easier to read.

3 + 5*10 == 2 + 50

You can change the order of operations by using parenthesis:

(3 + 5)*10 == 8*10

In the example that you have presented, removing the parenthesis will not change anything.

Upvotes: 2

orlp
orlp

Reputation: 118006

It means nothing, they're exactly the same.

Upvotes: 3

Related Questions