C (itan Re: Ligo asxeto ...)
Vasilis Vasaitis
vvas at hal.csd.auth.gr
Sun Sep 26 23:36:32 EEST 1999
On Sun, Sep 26, 1999 at 01:08:11PM +0000, D.A.Glynos wrote:
>
> On Sat, 25 Sep 1999, Vasilis Vasaitis wrote:
> > On Sat, Sep 25, 1999 at 02:28:07AM +0300, Giorgos Keramidas wrote:
> > >
> > > Pzzzzzttt ! xasate... next please...
> > >
> > > Ama exeis dnlwsei: int *p;
> > > Tote to p++ einai isodunamo me: p += sizeof(int);
> >
> > Ðæææææôôô! ×Üóáôå! Ï åðüìåíïò...
> >
> > ¶ìá Ý÷åéò äçëþóåé `int *p;', ôüôå ôï p++ åßíáé éóïäýíáìï ìå ôï `p += 1',
> > êáé ôåëéêÜ ôï p èá áðïêôÞóåé ôçí ôéìÞ ðïõ åß÷å áñ÷éêÜ ç ðáñÜóôáóç `p + 1'.
> > ÖõóéêÜ îÝñù üôé áðëÜ îÝ÷áóåò üôé Ý÷ïõìå íá êÜíïõìå ìå áñéèìçôéêÞ äåéêôþí êáé
> > åß÷åò óôï ìõáëü óïõ êÜôé óáí `p = (int *) ((int) p + sizeof(int))' (áí êáé
> > äåí ôï óõíåéäçôïðïßçóåò), üìùò ôïõò Üëëïõò ìðïñåß íá ôïõò ìðåñäÝøåéò.
>
> Vassilh , den katalava kala to argument sou.
> Uponoeis oti to parakatw den tha mas kanei print to noumero 2000 ?
>
> int main(){
> int a, b[3], *c;
>
> printf("The size of our integers is %i\n",sizeof(a));
> b[0]=1000;
> b[1]=2000;
> b[2]=3000;
> c=b;
> printf("The second element of the array is %i\n",*(++c));
> return;
> };
Áõôü âåâáßùò êáé èá ôõðþóåé 2000. Ôï ßäéï åðßóçò èá ôõðþóåé áí
áíôéêáôáóôÞóåéò ôï `++c' ìå ôï `c+1' Þ êáé ìå ôï `c+=1'. Áí üìùò ôï
áíôéêáôáóôÞóåéò ìå ôï `c+=sizeof(int)' ðïõ õðïóôÞñéîå ï Ãéþñãïò üôé åßíáé
éóïäýíáìï, ôï áðïôÝëåóìá ðïõ èá ðÜñåéò èá åßíáé ðïëý äéáöïñåôéêü...
--
Vasilis Vasaitis
vvas at hal.csd.auth.gr
Nuke them till they glow, then shoot them in the dark.
--
====================================================================
Gia boithia (h na diagrafhte) e-mail sto majordomo at hellug.gr
Ta archives tis listas einai sto http://lists.hellug.gr/archives
prin steilete kapoia erothsh psakte mipos exei hdh apanththei.
Gia opoiodipote problima stilte e-mail ston owner-linux-greek-users at hellug.gr
====================================================================
More information about the Linux-greek-users
mailing list