I have one doubt. Please see the below C program
int main(void){
unsigned int consttest_var = 1;
unsigned int i;
for(i = 0; i<10; i++){
consttest_var++;
consttest_func(consttest_var);
}
return 0;
}
void consttest_func(const unsigned int consttest_var1){
printf("\n%d", consttest_var1);
}
I tried the above code and I got value for consttest_var1
as 2,3,4....10. Why consttest_var1
should print the value when it was declared as const. I was expecting it will throwing error as read only. Can anyone explain this?