Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.java.programmer Subject: Re: arrays and variables Date: Sat, 06 Apr 2013 15:02:40 +0200 Lines: 33 Message-ID: References: <19un43xj77bua.vw45l4e2wshi.dlg@40tude.net> <1uednTu2Z5ByUcPMnZ2dnUVZ8i-dnZ2d@bt.com> <78a7719f-3519-48a5-b36d-d8b7ddcafe7c@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net XuL/0rPjYQaZGlC7V7fDfANzwvJ0RzJbDeFOY+/Snzz0PKXyY= Cancel-Lock: sha1:fk8MhfUsYLeGQ17bHbSfDzXtk8g= User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 In-Reply-To: <78a7719f-3519-48a5-b36d-d8b7ddcafe7c@googlegroups.com> X-Antivirus: avast! (VPS 130406-0, 06.04.2013), Outbound message X-Antivirus-Status: Clean Xref: csiph.com comp.lang.java.programmer:23346 On 05.04.2013 22:33, Lew wrote: > lipska the kat wrote: >> a pointer in C >> >> int x >> int *iptr; >> iptr = &x; >> iptr++; //stupid but not illegal >> >> How would I do that in Java using pointers (note the *pointer arithmatic*). > > Java does not have pointer arithmetic. > > It only has pointers for reference types, so the nearest equivalents are: > > int x; > Integer iptr; > iptr = Integer.valueOf(x); > // no pointer arithmetic Albeit: iptr has different semantics than in the C list because it does not alias the original value. An assignment to x after this line will go unnoticed by anybody using iptr while in C/C++ it will be noticed. Well, that's they way it is... Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/