Note that there are some explanatory texts on larger screens.

plurals
  1. POerror: initializer expression list treated as compound expression
    primarykey
    data
    text
    <p>I'm having trouble finding a solution to this error.. I have tried everything I could think of and have looked at a number of examples on the web. But I'm still stuck!</p> <p>Thanks</p> <p>error: initializer expression list treated as compound expression</p> <pre><code>unsigned char mbuffer[16]; int bcd_encode(32768UL, &amp;mbuffer[0], 4); &lt;---- error is on this line ------------------------------------------------- /* Encode the input number into BCD into the output buffer, of * the specified length. The BCD encoded number is right-justified * in the field. Return the number of digits converted, or -1 if the * buffer was not big enough for the whole conversion. */ int bcd_encode(unsigned long number, unsigned char *cbuffer, int length) { unsigned char *p; unsigned char n, m, bval, digit; n = 0; /* nibble count */ m = 0; /* converted digit count */ bval = 0; /* the bcd encoded value */ /* Start from the righthand end of the buffer and work * backwards */ p = cbuffer + length - 1; while (p &gt;= cbuffer) { if (number != 0) { digit = number % 10; number = number / 10; m++; } else digit = 0; /* If we have an odd-numbered digit position * then save the byte and move to the next buffer * position. Otherwise go convert another digit */ if (n &amp; 1) { bval |= digit &lt;&lt; 4; *p-- = bval; bval = 0; } else bval = digit; n++; } /* If number is not zero, then we have run out of room * and the conversion didn't fit. Return -1; */ if (number) return(-1); /* return the number of converted digits */ return(m); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload