I having trouble finding a solution to this error..Thankserror: initializer expression list treated as compound expression

unsigned char mbuffer<16>;int bcd_encode(32768UL, &mbuffer<0>, 4); = 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 & 1) { bval |= digit This post has been edited by jimblumberg: 29 August 2013 - 07:44 AMReason for edit:: Added missing code tags. Please learn to use them properly.




You are watching: Expression list treated as compound expression in initializer

*

#2jimblumberg


*
*

Re: error: initializer expression list treated as compound expression

Posted 29 August 2013 - 07:50 AM


The compiler is confused, it thinks you're trying to create an int variable named bcd_encode, but you're using different types in the initialization list. Is it your intent to declare a variable with that name? Or are you trying to call your function that has that name?You do know that you can't call a function outside all other functions, correct? You may want to study the function tutorials contained in my signature.Jim

This post has been edited by jimblumberg: 29 August 2013 - 07:51 AM


#3lafleur


Re: error: initializer expression list treated as compound expression

Posted 29 August 2013 - 08:15 AM


#4jimblumberg


Re: error: initializer expression list treated as compound expression

Posted 29 August 2013 - 08:18 AM


Be sure to call the function inside another function, for example:

int main() int bcdNum = bcd_encode(32768UL, &mbuffer<0>, 4); return(0);JimThis post has been edited by jimblumberg: 29 August 2013 - 08:18 AM


Re: error: initializer expression list treated as compound expression

Posted 29 August 2013 - 08:20 AM




See more: Review: Placebo A Place For Us To Dream, A Place For Us To Dream

I see the issued now! How stupid of me...this looks like it solved the problem....

unsigned char mbuffer<16>;int NX;NX = bcd_encode(32768UL, &mbuffer<0>, 4);