This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

number of strings in array

Hello all,

I have the following code:

const char BaudRate[][] = {"600","1200","2400","4800","9600","19200","38400","56700"};
. .
.

Idx = 0;
while (Idx++ < (sizeof(BaudRate)/sizeof(BaudRate[0]))) CheckSpeedOfLink(BaudRate[Idx]);

This code is an attempt to programmatically fill a array with selected text.

Can anyone help ?

Regards

Harry

Parents
  • const unsigned int BaudRate[] = {600,1200,2400,4800,9600,19200,38400,56700,0};

    Idx = 0;
    while(BaudRate[Idx]) CheckSpeedOfLink(BaudRate[Idx++]);

    or

    const char *BaudRate[] = {"600","1200","2400","4800","9600","19200","38400","56700",NULL};

    Idx = 0;
    while(*BaudRate[Idx]) CheckSpeedOfLink(BaudRate[Idx++]);

    Regards
    Paulo

Reply
  • const unsigned int BaudRate[] = {600,1200,2400,4800,9600,19200,38400,56700,0};

    Idx = 0;
    while(BaudRate[Idx]) CheckSpeedOfLink(BaudRate[Idx++]);

    or

    const char *BaudRate[] = {"600","1200","2400","4800","9600","19200","38400","56700",NULL};

    Idx = 0;
    while(*BaudRate[Idx]) CheckSpeedOfLink(BaudRate[Idx++]);

    Regards
    Paulo

Children
No data