Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

I have doubt in basic c

Status
Not open for further replies.

ragav4456

Full Member level 4
Joined
Aug 1, 2012
Messages
228
Helped
19
Reputation
38
Reaction score
17
Trophy points
1,308
Activity points
2,568
what is the meaning of this function?

if((X>255) || (X<0))
 

hello

Tell us before , how X is defined ?

unsigned char
signed char
int
unsigned int
 

If X is an 8-bit value it can't be more than 255 and a check for less than zero is meaningless if it's an unsigned value so I'm guessing it's an 'int' (signed).

It isn't a function in the programming sense, it's a query. It reads as "if the value of X is more than 255 or the value of X is less than zero". It means the following code will only be executed if X isn't between 0 and 255.

Brian.
 

As mentioned by others it depends on the size of X. If X is unsigned int its range is 0 to 65535. The Conditional statement check if X > 255 or X < 0. If any of the 2 condition X > 255 or X < 0 is true then the if condition will be true and the if statement will be executed.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top