Explain #define SWITCH_PRESSED (bit) 1 in C

Status
Not open for further replies.

Help

Advanced Member level 2
Joined
Feb 15, 2005
Messages
617
Helped
7
Reputation
14
Reaction score
3
Trophy points
1,298
Activity points
7,065
Hi...

Anyone help me to explain this #define SWITCH_PRESSED (bit) 1??
Is it define the switch_pressed is High??

Thanks.....
 

C (#define)

Means that when you used the keywords SWITCH_PRESSED it will return a 1 or gives a one.
 

    Help

    Points: 2
    Helpful Answer Positive Rating
Re: C (#define)

#defines are just text substitutions

So whenever you write SWITCH_PRESSED the preprocessor will replace it with (bit) 1 before passing it to the compiler.

Simple but powerful ...

best regards
 

    Help

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…