Reputation: 33
I have encountered the following statement in C code and do not understand how to interpret it.
Recognizing the 2nd operand as a pointer reference (*a
), it looks to me like the statement is missing an operator between the operands (interpreting *
as pointer reference, not multiply).
I have run the code containing this statement, and it completes without errors, so I believe the statement is valid, but I just don't understand what its doing.
Here it is:
val +=input_ptr[a] *filter_ptr[b];
Thank you.
Upvotes: 2
Views: 85
Reputation: 48287
You have two arrays: input_ptr
and filter_ptr
, you can get the value stored in those cells by doing, lets say, input_ptr[0]
so :
val is increased with the value stored at index 'a' in array input_ptr
multiplied by the value stored at index 'b' in array filter_ptr
Upvotes: 5