VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 07:03:04 04/25/02 Thu
Author: Hjálmtýr
Subject: Re: Prófdæmi 2 (11.maí 2001)
In reply to: Einar 's message, "Prófdæmi 2 (11.maí 2001)" on 15:02:17 04/24/02 Wed

>Hausinn á fallinu skipta lítur eftirfarandi út.
>

>void skipta(node* L, int x, node* &A, node* &B )
>

>Ég skil ekki hvað merkingu færibreytan
node*
>&A
hefur er þetta "pointer" eða reference eða
>hvað ?

Þetta er tilvísun á bendi á node(!)

Ástæðan fyrir þessari gerð viðfangs er að við viljum geta breytt bendinum sem við sendum inn. Reyndar sendum við
inn tóma benda A og B, því við lok fallsins eiga þeir að benda á sitthvorn listann. Þess vegna eru þeir
tilvísunarviðföng.

Athugaðu að node* er eins og hvert annað tag. Þú veist örugglega hvað er að gerast í:

void fall( int &i, int &j )

Í fyrra dæminu er bara node* (þ.e. hnútabendir) í stað int. Í bókinni fela þeir þetta oftast með
"typedef node* link;", þá geta þeir skrifað:

void skipta(link L, int x, link &A, link &B )

Ég veit ekki hvort þetta er skýrara.

[ Next Thread | Previous Thread | Next Message | Previous Message ]

Post a message:
This forum requires an account to post.
[ Create Account ]
[ Login ]
[ Contact Forum Admin ]


Forum timezone: GMT-8
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.