Using "strcpy" to assign value to dynamic char array

pascal111 judas.the.messiah.111 at gmail.com
Tue Nov 2 01:05:30 UTC 2021


On Monday, 1 November 2021 at 21:37:59 UTC, Ali Çehreli wrote:
> On 11/1/21 2:28 PM, pascal111 wrote:
>
> > This can serve the style I want.
>
> I am feeling funny right now and showing incorrect code. It's 
> impossible to fit "Hello World!" in "xyz". As Steve said, don't 
> do that. :)
>
> > It uses OOP style like C++ by putting a
> > pointer as a property,
>
> D's slices are the equivalent of the following struct (showing 
> for int):
>
> struct __Slice__ {
>   size_t length;
>   int * ptr;
> }
>
> So, .ptr is simply a member variable. (Assigning to .length 
> does some magic like allocating more memory in some cases; 
> otherwise it is a member variable as well.)
>
> > but pointers themselves are low level.
>
> arr.ptr is as low as it gets: It is a pointer.
>
> Ali

Anyway, I'm a beginner and any information is useful to me.


More information about the Digitalmars-d-learn mailing list