Is any direct function is available for the complement of the char variable
get a C book, this is basic C
It's an operator, not a function. The operator is ~.
I think this is for the Bit variable what about the char variable
The answer is the same: ~.
How to take ones compliment of char variable
"I think this is for the Bit variable"
You are mistaken - see your 'C' textbook.
As already stated, this is a standard 'C' operator - Bit variables are a Keil extension.
You do have a 'C' textbook, don't you?
Why do you have this aversion to reading it?
http://www.keil.com/forum/docs/thread8910.asp
Once again, the answer is the same: ~.
Is to complement your library with a 'pure' C text book (NOT "C for the '51"). Now for something tryly awful: you also have to read it.
Erik
"you also have to read it"
Or at least look at the index - and find where the Complement Operator is described!
just a wild guess
The OP is under the assumption that "C for the '51" (whatever the actual title) is a C book.
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".
"no raise at next review"
Unless, of course, he works somewhere where they pay per line of code...
"I even tested it with Keil."
And also with your tongue firmly in your cheek, surely...? ;-)