Go Down

Topic: (char)n vs char(n) (Read 379 times) previous topic - next topic

BobW

What is the difference (if any) between (char)n and char(n) ?
The test code below produces:

88
X
88
X
88

No apparant difference between lines 3 and 5.

Thanks.
Bob W.

Code: [Select]

int n = 88;
Serial.println( n );
Serial.println( char(n) );
Serial.println( n );
Serial.println( (char)n );
Serial.println( n );

JosAH

'(char)n' is the old C notation; 'char(n)' is C++s functional cast notation; both do exactly the same thing.

kind regards,

Jos

BobW

Thank you Jos !
Bob W


'(char)n' is the old C notation; 'char(n)' is C++s functional cast notation; both do exactly the same thing.

kind regards,

Jos

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy