Is any direct function is available for the complement of the char variable
A function to take the complement of a char. I even tested it with Keil.
char GetComplementOfAChar(char myChar) { return (~myChar); }
int main(void) { char myChar2;
myChar2 = GetComplemenOfAChar('a'); }
'a' = 0x61 return = 0x9e
that should send the OP spinning. He got what he wanted "a function to ..." and now you give him some totally silly code responding to the letter of the request.
Is the purpose of the forum that when someone ask "how do I do this in a stupid way" to "help" him/her forever code such in a most inefficient way. Or is it REAL help to post It's an operator, not a function. The operator is ~ as Dan did and leave it at that.
Anyone working for me that did a complement as a function would at the very minimum be told "no raise at next review".
Erik
"no raise at next review"
Unless, of course, he works somewhere where they pay per line of code...
Unless, of course, he works somewhere where they pay per line of code...<p>
Hm, I think they have missed that in the Guide to Writing Unmaintainable Code.
"Replace basic operators with self-written functions."
I'm sure replacing some binary operators with functions that simulate the truth tables would be great fun and extremely educational.
""Replace basic operators with self-written functions."
And hide them in macros, of course...!
;-)
View all questions in Keil forum