search
Login

Categories


C Books Guide and List
C++ Books Guide and List
Best Java Books

3.8k questions

4k answers

117 comments

10.7k users

0 votes
23 views
asked Guru 27.1k points 31 47 92

1 Answer

0 votes
Constants perform the same tasks as read-only variables with some differences. The differences between constants and read-only are
 
Constants:
Constants are dealt with at compile-time.
Constants supports value-type variables.
Constants should be used when it is very unlikely that the value will ever change.
 
Read-only:
Read-only variables are evaluated at runtime.
Read-only variables can hold reference type variables.
Read-only variables should be used when run-time calculation is required.
 
answered Guru 24.6k points 29 51 75

Related questions

0 votes
1 answer 25 views
0 votes
1 answer 139 views
139 views
What is the difference between const and readonly and do you use one over the other?
asked shivani Sr Member 1.1k points 13 27 42
0 votes
1 answer 32 views
0 votes
1 answer 389 views
389 views
asked shivani Sr Member 1.1k points 13 27 42
...