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.

What does 'if' function mean?

Status
Not open for further replies.

Help

Advanced Member level 2
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,

if(CHARACTER == '\n')

what is this mean??

Thanks...
 

devennan

Member level 3
Member level 3
Joined
May 7, 2004
Messages
66
Helped
5
Reputation
10
Reaction score
1
Trophy points
1,288
Location
India
Activity points
798
Re: 'if' function

Try explaning your problem in more details
if(CHARACTER == '\n')

CHARACTER is a char type which checks for '\n'

the ascii value of '\n' is 10

if it is a match condition is true and code after the if is executed else not

Regards
Deven
 

    Help

    Points: 2
    Helpful Answer Positive Rating

flatulent

Advanced Member level 6
Advanced Member level 6
Joined
Jul 19, 2002
Messages
4,626
Helped
489
Reputation
980
Reaction score
151
Trophy points
1,343
Location
Middle Earth
Activity points
46,689
Re: 'if' function

This looks like a matlab branching function. The double equal signs are a comparison of the variable named character and the \n. This will return a logic true or false which the if statement will act on.
 

    Help

    Points: 2
    Helpful Answer Positive Rating

Help

Advanced Member level 2
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
Re: 'if' function

Hi,

I already understand, the ASCII code show the 10=A is LF (Line Feed), that mean the Line Feed is next line izit??

Can you tell me the ASCII function from 0-31 and how to use it, haa...ha... the 32 i know.. is space. The other (33-127) i understand...

Thank you..
 

vdaniel

Full Member level 4
Full Member level 4
Joined
Oct 8, 2004
Messages
204
Helped
8
Reputation
16
Reaction score
0
Trophy points
1,296
Activity points
2,157
Re: 'if' function

CHARACTER is a variable of char type. That means, that somwhere in the program code there should be a line like

char CHARACTER;

'\n' is a C standard char type constant, which means "New Line", an integer value is equal to 10, or 0x0A

Similarly the '\r' is a char type constant that means "Carriage Return" with value 13, or 0x0D.

You can find all ASCII codes on: https://www.lookuptables.com/

Varuzhan
 

Help

Advanced Member level 2
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
Re: 'if' function

Hi,

Q1)
Can you give the simple sample program got related the \r (Carriage Return), how to use this command and how it work??

Q2)
Do you know how to use the ASCII, eg. NUL, SOH, STX, ETX, EOT, ENQ, SO, SI, .... and so on? Do you have any webside teach you how to use the code?

Thany you..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top