is subscript operator [ ] unary or binary operator ?
I'm quite new to C++ and was going through operator operloading and wondered is subscript a unary or binary?
The subscript operator is a binary operator in the strict sense as it takes two arguments, the reference to the object and the value.
int arr[3];
Here you can see that [] operator makes use of both arr and 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With