avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [avr-chat] function with default value of argument


From: Weddington, Eric
Subject: RE: [avr-chat] function with default value of argument
Date: Mon, 22 Sep 2008 06:30:18 -0600

 

> -----Original Message-----
> From: address@hidden 
> [mailto:address@hidden
>  On Behalf Of Kreyl
> Sent: Monday, September 22, 2008 3:10 AM
> To: avr-chat; address@hidden
> Subject: [avr-chat] function with default value of argument
> 
> 
>     Hi!  
> 
>   I would like to use function with default value of an argument, so I
>   wrote next:
> 
>   Definition:
> 
>   void LCDWrite (uint8_t Destination, uint8_t AData, uint8_t 
> DontWait=0);

That is incorrect C AFAIK.

 
>   Implementation:
> 
>   void LCDWrite (uint8_t Destination, uint8_t AData, uint8_t 
> DontWait) {
>     // do smth.
>   }
> 
> 
>   But I receive error message about definition:
> 
>   error: expected ';', ',' or ')' before '=' token
> 

And that is why you got the error message.

You cannot give a "default value" to a parameter in C language.
 
>   What am I doing wrong? Where can I read about it?

The GCC User Manual? I don't know if you are try to use some C language 
extension that I'm not aware of, or C++, or something else...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]