[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] gets strengen



From: "Sune" <sslug@sslug>

> > > Array Declarations
> > > An "array declaration" names the array and specifies the type of its
> > elements. It can also define
> > > the number of elements in the array. A variable with array type is
> > considered a pointer to the
> > > type of the array elements.
> > >
> > I C er char a[]
> > en adresse i memory hvor det første
> > element i arrayet ligger.
> > char *a, er adressen på en pointer til det første
> > element i arrayet. sizeof på *a vil altså
> > returnere størrelsen på poiteren og den er, som en tidlige pointerede
> > (undskyld men jeg har fået slettet dit indlæg),
> (det kan hentes på www.sslug.dk)
> > næppe ens med størrelsen af arrayet.
> >
> > Tag forsjov at kigge på http://www.eskimo.com/~scs/C-faq/top.html, det
er om
> > ikke andet interessant læsning.
>
> Jeg tror jeg fandt hvad vi søgte:
> http://www.eskimo.com/~scs/C-faq/q6.3.html
>
> "An lvalue of type array-of-T which appears in an expression decays (with
three exceptions) into a
> pointer to its first element; the type of the resultant pointer is
pointer-to-T. "
>
> Og det er jo hvad jeg har sagt hele tiden ;)
> Jeg tror du tænker på en af undtagelserne som han nævner, og det er netop
sizeof operatoren.
>

Jeg burde ikke være oppe nu, men jeg kan ikke sove fordi jeg skal flyve til
Frankrig i (dag) morgen kl 0700, men det er nok mere afsnit 6.2 du skal
kigge på. Det har lidt at gøre med hvad compileren gør når du skriver char
*a, og når du skriver char a[]. Det er ikke helt det samme sted de to peger.
Men læs selv i ovennævnte afsnit.

Mvh Magnus



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