depends upon the optimization performed.
Some compilers, on seeing a const value, store there literal value to get
faster access (as it is assumed that const won't be modified)
Hence you get the output:0 2 as value of i is now the already stored literal
in the optimized plan generated by the compiler.

But if such an optimization is not performed, then you get 2,2

On 22 August 2011 00:03, Abhishek <[email protected]> wrote:

> i am compiling it on linux, it is giving me the o/p 2,2.
>
> whatever i know is that, to prevent constants being modified, pointers
> should also be declared constant.
> like..
> const int *p;
>
> now it will produce error.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/QBiQoXPIk78J.
>
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards
Siddharth Srivastava

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to