229k views
5 votes
Which statement is false?If a value should not change in the body of a function to which it is passed, the value should be defined const to ensure that it is not ac-cidentally modified.Attempts to modify the value of a variable defined const are caught at execution time.One way to pass a pointer to a function is to use a non-constant pointer to non-constant data.It is dangerous to pass a non-pointer into a pointer argument.

User Dafne
by
7.8k points

1 Answer

5 votes

Answer:

Attempts to modify the value of a variable defined const are caught at execution time

Step-by-step explanation:

The false statement among the options is Attempts to edit the value of a variable defined const are caught at execution time while other options are true.

A const variable should not be modify because the main reason of having a const variable is not to make modifying it possible. If you prefer a variable which you may likely want to modify at some point, then don't just add a const qualifier on it. Furthermore, Any code which modify's a const by force via (pointer) hackery invokes Undefined Behavior

User Ackushiw
by
8.0k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.