[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] pass by reference



Henrik Persson <sslug@sslug> skrev:

> Det er ikke rigtigt. Et array navn er blot en pointer til det første
> element i array'et.

Jeg har tidligere slået på tromme for at man læser comp.lang.c FAQ'en
hvis man har problemer med forskelle og sammenhænge mellem pointere og
arrays, og det råd gælder stadig.

        http://www.eskimo.com/~scs/C-faq/s6.html


Men nej, pointere og arrays er ikke det samme.



> Mao. er erklæringerne
> 
> char s[];
> 
> og
> 
> char *s;
> 
> ekvivalente.

Hvis de er ækvivalente er det da mystisk at den ene kan oversættes men
den anden kan ikke:

sslug@sslug and]$ echo 'int main() { char *s; return 0; }' >a.c;gcc a.c
sslug@sslug and]$ echo 'int main() { char s[]; return 0; }' >a.c;gcc a.c
a.c: In function `main':
a.c:1: array size missing in `s'
sslug@sslug and]$ 



Venlig hilsen,
Anders


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 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] *