, C/++ . , , , , , , . , , - , .
, , :
int a[10], i;
i = 5;
a[i] = 42;
5[a] = 37;
std::cout << "Array element = " << a[i] << std::endl;
- ++. , C/++ .
Neil Butterworth has already commented on the benefits of using std :: vector and the at () access method for him, and I cannot follow up on his recommendation strongly enough. (Unfortunately, the STL designers blew up a great opportunity to make test access to the [] statements, and the at () methods were untested. It probably cost the C ++ developer community millions of hours and millions of dollars and will continue to do so.)
source
share