That sets something at i elements from the start of buf to
some_double, however I didn't see a place where you set buf
itself to point to anything that might hold i elements (I can't
parse the code in the message w/o CR's so I'm extemporizing here):

        BUFTYPE bunchaElements[100];
        BUFTYPE *buf = bunchaElements;

See this for a pretty good discussion:
http://en.wikibooks.org/wiki/C_Programming/Pointers_and_arrays

MS


Jun Zhang wrote:
> buf[i].target = table[i].some_double;
> 
> this code is not set pointer to some value? 
> 
> thanks
> 
> 2009/8/29 Michael Schippling <[email protected] <mailto:[email protected]>>
> 
>     You don't seem to have set buf to point to anything...
>     MS
> 
>     Jun Zhang wrote:
> 
>         Hello, everyone. I am new to tinyos and nesc. and I have the
>         following data strucuture  typedef nx_struct rt_link { nx_addr_t
>         target; nx_addr_t nexthop; } rt_link_t;  typedef struct rt_entry
>         { double some_double; uint8_t some_int; } rt_entry_t;  uint8_t
>         flag = 0x01; uint8_t i=0; rt_link_t * buf; rt_entry_t table[10];
>          if ( flag & 0x01) { buf[i].target = table[i].some_double;
>         buf[i].nexthop = table[i].some_int; }  and if I use if ( flag ==
>         1) { buf[i].target = table[i].some_double; buf[i].nexthop =
>         table[i].some_int; }  I will get different value from buf[0],
>         whats the difference?
>         -- 
>         Kind Regards
> 
>         Jun
> 
> 
>         
> ------------------------------------------------------------------------
> 
>         _______________________________________________
>         Tinyos-help mailing list
>         [email protected]
>         <mailto:[email protected]>
>         
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> 
> 
> 
> 
> -- 
> Kind Regards
> 
> Jun
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to