What is a "c_dest_entry" and where do you initialize your array thereof?

It would appear that c_dest_entry is a structure and thus so is "checking",
so when you go to printf checking (which is a copy of the current
int_table[i] entry) as an int the compiler is legitimately worried
about your intent... If you are working with an array of structs --
rather then an array of simple ints -- you should probably use
pointers. See http://en.wikibooks.org/wiki/C_Programming for a good
intro to C if you don't know what I'm talking about.

The runtime problem could be the result of not having your int_table
array fully initialized. Do you know for sure that there are 64
(which is I assume the value of C_DEST_CID) valid elements therein?

MS


[email protected] wrote:
> Hello,
> 
> I'm trying to search an array of structs that I built to match some  
> number. However when simulating my search-loop seems to be aborted  
> somehow (always at the same index).
> 
> I used the following Code:
> 
> bool isin_cdest_table(c_dest_entry int_table[], uint16_t dest) {
>    int i = 0;
>    c_dest_entry checking = int_table[i];
>    while (((checking.t_dest) != dest) && (i < C_DEST_CID)) {
>    i++;
>    checking = int_table[i];
> * printf("i: %hhu - checking: %hhu \n", i, checking); printfflush();
>    }
>    printf("ENDE i: %u \n", i); printfflush();
>    if (i == (C_DEST_CID - 1)) {
>    printf("NO C_DEST entry found \n"); printfflush();
>    return FALSE;
>    }
>    else {
>    entry_found_no = i;
>    printf("C_DEST entry found %hhu \n", i); printfflush();
>    return TRUE;
>    }
>    }
> 
> This function is called in CC2420ActiveMessageP.nc inside the command  
> AMSend.send.
> My Array has a size of 64 and the loop aborts at 12 (always). Can  
> anyone help me?
> 
> The compiler gives me the following warning I can't interpret:
> 
> int format, c_dest_entry arg (arg 3) and refers to the line marked  
> with an asterisk (*)
> 
> Can anyone tell me:
> -WHY this is happening
> -HOW I can avoid it / fix it
> 
> Thank you for your help.
> 
> 
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to