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: colinv@xxxxxxxxxxxxxx (colinv)
  • Subject: c = c++ problem
  • Date: Fri, 31 Mar 2000 09:32:11 +0100

Rajesh Gupta wrote:
> 
> 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 ?
> 

c++ first returns the value of c and then increments it
++c increments it's value and then returns.

If you just want to increment c then just c++ will do the job.
-- 
-------------------------------------------------------------------------
Colin Vipurs                                         Tel: (01430) 431
100
Software Developer                                   Fax: (01430) 432
022
"PA" Listings, Howden
-------------------------------------------------------------------------
Victims of Success


-------------------------------------------------------------------------

PA News Limited
PA NewsCentre
292 Vauxhall Bridge Road
London SW1V 1AE
 
Registered in England No.2858918
 
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited.  If you
receive
this in error, please contact the sender and delete the material from
any
computer.

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