Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

c = c++ problem


  • From: rodrigo@xxxxxxxxxxxxxxxx (Rodrigo de Almeida Sodré)
  • Subject: c = c++ problem
  • Date: Fri, 31 Mar 2000 10:27:54 -0300

Well, maybe

   c = c++;

is treated as

   class C {
     int c = 10;

     int inc() {
       int c_ = c;
       c = c + 1;
       return c_;
     }
   }

Rodrigo A. Sodre
Analista de Sistemas
Foton Informatica e Servicos
(061) 328-5060 R:243
rodrigo@xxxxxxxxxxxxxxxx 



> -----Original Message-----
> From: Pat Ryan [mailto:ryanxpx@xxxxxxxxxx]
> Sent: Friday, March 31, 2000 10:15 AM
> To: Rajesh Gupta; advanced-java@xxxxxxxxxxxxxxxx
> Subject: Re: c = c++ problem
> 
> 
> 
> I saw the other responses, and while they are correct, I 
> agree with Rajesh,
> after the assignment, just what is being incremented?  It 
> would appear to
> be the variable c.
> 
> However, the result you are seeing would indicate that the 
> right hand side
> of the assignment is a copy of c.
> 
> -Patrick.
> 
> 
> 
> 
> 
> "Rajesh Gupta" <rajesh_gu@xxxxxxxxxxx> on 03/31/2000 03:14:08 AM
> 
> To:   advanced-java@xxxxxxxxxxxxxxxx
> cc:
> Subject:  c = c++ problem
> 
> 
> hello all
> 
>    i have a simple problem
> 
>    int c = 10;
>    c = c++;
> 
>     and c is still 10 !
>    if use c = ++c; this gives me 11 this is quite obvious.
> whats the logic behind c = c++ giving original value of c this ?
> 
> thanks in advance
> 
> Rajesh
> 
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
> 
> 
> ---
> To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
> To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
> 
> 
> Patrick H. Ryan
> Senior Design Engineer
> Hobart Technology Center
> 
> 
> 
> 
> ---
> To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
> To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
> 

---
To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx
To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx