Hi All, I am newbie in this. Is this function declaration right, as it has bit as parameter, void myfunc(unsigned char,bit);
Ashutosh
No, it isn't.
You really need to get a good 'C' textbook (or books) to learn the basics of the 'C' programming language.
Some suggestions here: http://www.keil.com/books
In C51 it's legal - Or at least, it's accepted.
Try compiling this (non-functional) snippet:
void myfunc(unsigned char,bit); void main(void) { myfunc(1,1); } void myfunc(unsigned char a,bit b) { if (b) ++a; }
It's completely standard 'C'.
Here's a quiz:
int Test(void) { int a; return sizeof a; }
Who reached for their favourite 'C' book?
At least 99.999% of existing code would not look like that ;)
Make that 100% round here...
It is very long between each time I see anyone use sizeof as an operator instead of treating it as a function.
Out of "compatibility", I use it as a function just to avoid questions.
... I use it as a function just to avoid questions.
On the other hand, the non-parenthesized version, when used, is an immediate clue that sizeof's operand is not a type. It is a subjective matter whether an individual or shop puts any value on that language feature.
View all questions in Keil forum