You have made a pointer, but it doesn't point to anything...
or more preciesely it is probably initialized to 0, so it
points to the bottom of memory. Since there isn't any mem
management (to speak of) the easiest thing is to create
your array directly:

        uint16_t dataArr[SOMEsmallSIZE];

Otherwise the usage is the same as you show.

For all kinds of interesting facts about C, see:
http://en.wikibooks.org/wiki/C_Programming

MS

Islam Hegazy wrote:
Hi all
I want to use a dynamic array in my sensor application. Is there a way to iniailize the array before using it like the keyword new in C++? I defined the array as : uint16_t *dataArr
when I access it as : dataArr[numData++] = value
it gives a runtime error.
I am working with mica2 and TinyOS1. Regards
Islam Hegazy


------------------------------------------------------------------------

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

--
Platform: WinXP/Cygwin
TinyOS version: 1.x, Boomerang
Programmer: MIB510
Device(s): Mica2, MicaZ, Tmote
Sensor board: homebrew

_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to