[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] Extern funktion



On Mon, 19 Jun 2000 16:26:14 +0200, Peter Gylling <sslug@sslug> wrote:
>--SNIP--
>Den ekterne funtion er som følger:
>--SNIP--
>/* Kaldes fra main.c */
>func_check(int tjek)
>{
>  
>  ++tjek;
>}
>--SNIP--
>Når dette kompileres med gcc fås output af tjek til tjek=5, men 
>hvorfor det?

For func_check's parameter er call by value, og ikke call by reference. Hvis du
fil have resultatet til at være 6, skal typen af func_check være:

func_check(int &tjek)

Så arbejder du ikke længere på en kopi af variablen men på selve variablen.

-- 
Anders Bo Rasmussen          mailto:sslug@sslug
Frimestervej 42 1.tv         http://www.image.dk/~abr
2400 Kbh. NV
Denmark


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:08 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *