[En-Nut-Discussion] pointer don't work?

Landsperger, Werner Werner.Landsperger at cassidian.com
Thu May 12 16:55:36 CEST 2011


Hey!

thats really true and that was my first attempt! But It doesn't work so
I thought I've had to write the adress into the pointer. I've tried it
again now without "&" and so I came back to the proper problem. And now
it works. Why? Stefan Hax is absolutely right. The function strlen()
doesn't work here and after using strlen(), however, the pointer doesn't
work not any longer! I've deleted the function and now it works ;) This
function crazed me so much that I've got completely confused with the
pointer. 

Thanks again!



-----Original Message-----
From: en-nut-discussion-bounces at egnite.de
[mailto:en-nut-discussion-bounces at egnite.de] On Behalf Of Nathan Moore
Sent: Thursday, May 12, 2011 4:21 PM
To: Ethernut User Chat (English)
Subject: Re: [En-Nut-Discussion] pointer don't work?

> > pointer = &buff;                               // should set a
pointer
>

This line is an error.  You're probably getting a warning about it from
your compiler telling you that you are making an assignment without a
cast.

   pointer = buff;

That's what you want to do because you don't want the address of the
buff variable, but you do want the value of the buff variable, which is
the address of the malloc-ed memory.

This is basic C
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion



More information about the En-Nut-Discussion mailing list