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 typedef emun mean?

Status
Not open for further replies.

Terminator Electricity

Member level 5
Joined
Feb 2, 2006
Messages
91
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,973
what does typedef mean

Hi what does this statement mean ?

typedef enum {
RC5_0 = 0,
RC5_1 = 1,
RC5_X = 2 /* no emission */
} RC5_EMIT;

what does enum mean from the first place ? is it a structure?
 

RDRyan

Full Member level 2
Joined
May 24, 2007
Messages
133
Helped
20
Reputation
40
Reaction score
3
Trophy points
1,298
Location
China
Activity points
1,976
what does typedef

enum is a data type in C, not a structure.
the code define a new data type "RC5_EMIT" and have the same meaning of
"enum{ RC5_0=0, RC5_1=1,RC5_X=2}".

Ryan
 

Terminator Electricity

Member level 5
Joined
Feb 2, 2006
Messages
91
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,973
Thanks alot for help ,,

I have some other questions if u dont mind

static const char *StateName[] : what sense does declaring the array as a pointer gives ? isnt the array already a pointer ?????!!!!
what does declaring a const char means ?

Thanks
 

RBB

Full Member level 5
Joined
Jul 2, 2007
Messages
304
Helped
71
Reputation
142
Reaction score
36
Trophy points
1,308
Location
USA
Activity points
2,559
Pointers to arrays are used in multidimensional arrays.
 

RDRyan

Full Member level 2
Joined
May 24, 2007
Messages
133
Helped
20
Reputation
40
Reaction score
3
Trophy points
1,298
Location
China
Activity points
1,976
The array is a pointer, and it point to a constant char. The char can not change, it is constant, so using const char definition.

Ryan
 

btbass

Advanced Member level 5
Joined
Jul 20, 2001
Messages
1,897
Helped
438
Reputation
880
Reaction score
287
Trophy points
1,363
Location
Oberon
Activity points
12,861
Like this:

Code:
const char *strings[] = 
{
"String one",
"String two",
"String three"
};

printf("%s", strings[0]);

prints String one

strings[0] = "String one", strings[1] = "String two" and strings[2] = "String three"

static is a scoping rule. The array can only be seen in the current file.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top