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

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

c# - Search and Add Comment with OpenXML for Word -