Go Down

Topic: (char)n vs char(n) (Read 363 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