Can I declare only specific elements of an array as constant? (C/C++/Fortran) -


scenario: pass e.g. 2d matrix argument in function , able read , change elements, but i prevent accidental writting in let's last column. somehow tell compiler use specific elements in function constant.

probably can't done useful in scenarios.

an array contiguous block of objects of common type; suggesting not supported.

the appropriate solution encapsulate array , access through functions can apply required semantics. in fact if used c++ encapsulate in class [] operator overloaded can apply semantics require while still using array access notation.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -