+ 1
Const in c
Why should I define a variable as const if it won't change value? Will it get less memory or what?
5 Respuestas
+ 8
Constant values usually allow for faster access because they can be stored in read-only sections of the memory. And it prevents that your values get changed by accident (or someone with bad intentions)
0
When you coded
Const int var =10;
As that time the value of the variable is will be fixed ,you can not change it
0
I can make just int var=10 and I won't change it. Why should I define it as const?
0
We use the const keyword when we don't want to change fix value
https://code.sololearn.com/cQRVV7VVYjy2/?ref=app
Check my following code
0
Yes but why should it be defined?