ERROR - "cannot implicitly convert expression (s) of type int[3u] to int*"
Justin.SpahrSummers at gmail.com
Fri Jun 18 19:09:46 PDT 2010
On Fri, 18 Jun 2010 08:41:17 -0700, Justin Spahr-Summers
<Justin.SpahrSummers at gmail.com> wrote:
> On Fri, 18 Jun 2010 01:25:32 -0400, Chick Corea <chick.zcorea at gmail.com>
> > Those are the result of code that I pulled directly from the D v1 docs from
> > http://www.digitalmars.com/d/1.0/arrays.html
> > Specifically, the code is this.
> > int* p;
> > int s;
> > int a;
> > p = s;
> > p = a;
> I can't speak as to why the D2 code doesn't work, but this example in
> the documentation is flat out wrong. To assign a D array to a pointer,
> you must use the .ptr property, so that the correct code is actually:
> int* p;
> int s;
> int a;
> p = s.ptr;
> p = a.ptr;
> Hope this clears things up.
I followed up last night, but my post didn't show up until this morning.
Sorry for the redundant answer! :X
More information about the Digitalmars-d-learn