[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



Peter Gylling <sslug@sslug> skrev:

> Når dette kompileres med gcc fås output af tjek til tjek=5, men 
> hvorfor det?

Fordi func_check() funktionen får sin egen kopi af den øverførte
værdi. Det er forvirrende at give de to variable samme navn, for det
er i praksis to forskellige variable - som blot har samme værdi i det
øjeblik funktionen kaldes.



Dit spørgsmål svarer faktisk til at undre sig over at i beholder
værdien 5 i følgende eksempel:

int main()
{
        int i;
        int j;

        i = 5;
        j = i;
        ++j;
        printf("i = %d\n", i);
        return 0;
}

Her modsvarer j den lokale tjek variabel i dit eksempel.

-- 
Regards, Anders                         If a Microsoft product
(address is valid)                      fails, who do you sue?


 
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] *