better you first check you TC++3.0 options for the compiler warnig settigns.
where you would find the checklist for warnigs to be displayed or not.

On 1/5/07, Adithyan K <[EMAIL PROTECTED]> wrote:

  Hi Sunil,

No I am not getting any warnings......

Friendly,

K Adithyan

----- Original Message ----
From: Sunil Nair <[EMAIL PROTECTED]>
To: [email protected]
Sent: Thursday, 4 January, 2007 2:37:09 PM
Subject: Re: [c-prog] Changing value of a constant!

 *Adithyan K <[EMAIL PROTECTED] co.uk>* wrote:
>I am getting correctly.

May be ......but i think u would possible get a (level 1) compiler
warning...
I am not sure too.. sry :)

with regards,
Sunil

*Adithyan K <[EMAIL PROTECTED] co.uk>* wrote:

  Hi Ray,

Yes. I ran this code and it is getting executed fine.

Both c and *p points to 1000 only.

I am getting correctly. I am using Turbo C++ 3.0.


Friendly,

K Adithyan

----- Original Message ----
From: Ray Devore <rbdevore2007@ yahoo.com>
To: [EMAIL PROTECTED] com
Sent: Wednesday, 3 January, 2007 8:47:24 AM
Subject: Re: [c-prog] Changing value of a constant!

 --- Adithyan K <[EMAIL PROTECTED] co.uk <adithyank%40yahoo.co.uk>> wrote:
> Friend,
>
> You can declare a pointer and make it point to the
> constant.
> Then, you can use the indirection operator to write
> the new value in the address of the constant.
>
> Ex:
> ---
>
> const int c=100;
> int *p;
> c=&p;

Shouldn't this be:
p = &c;

> *p=1000; /*valid in c*/
>
> Now, you can "printf" to print the value of c,
> which will print 1000.

Have you actually ran the code and printed the value
of c? IIRC the last time this came up, *P printed out
1000 but c still printed out 100.

Ray

>
> This will work only in c. But, since C++ is clever
> enough, this syntax is not allowed
>
> Friendly,
>
> K Adithyan
>
>
>
> ----- Original Message ----
> From: Ray Devore <rbdevore2007@ yahoo.com <rbdevore2007%40yahoo.com>>
> To: [EMAIL PROTECTED] com <c-prog%40yahoogroups.com>
> Sent: Tuesday, 2 January, 2007 10:33:45 PM
> Subject: Re: [c-prog] Changing value of a constant!
>
> --- Gopi Krishna Komanduri <gopikomanduri@
> yahoo.com>
> wrote:
> > Hi,
> > I tried to change the value of a constant
> > variable
> > whose memory will be in .rdata. But I am unable to
> > do
> > it. Could you please go through the following code
> > and
> > suggest where I went wrong.
> <snip code>
> > Thanks&Regards,
> >
> > GopiKrishna Komanduri
> > Software engineer
> > NCR Corporation PVT Ltd.
> > 9849124680
> > gopikomanduri@ yahoo.com
> > gopikrishna. komanduri@ ncr.com
> >
> Think of a constant as read-only memory. Where you
> are going wrong is in trying to change a constant.
>
> <rant>
> There is no such thing as a constant variable. A
> constant doesn't vary. You can have a constant and
> you can have a variable, but you can't have a
> constant that varies.
> </rant>
>
> Ray
>
> ____________ _________ _________ _________ _________
> __
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail. yahoo.com
>
>
>
> Send instant messages to your online friends
> http://uk.messenger .yahoo.com <http://uk.messenger.yahoo.com/>

____________ _________ _________ _________ _________ __
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail. yahoo.com <http://mail.yahoo.com/>


Send instant messages to your online friends http://uk.messenger.yahoo.com


Send instant messages to your online friends http://uk.messenger.yahoo.com



Send instant messages to your online friends http://uk.messenger.yahoo.com





--
S/W Engg. - Products
Sasken Communication Technologies Limited,Pune
Email: [EMAIL PROTECTED]
Tel: DID+ 91 20 66418525
mob. 09370985062
URL: www.sasken.com

Reply via email to