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.

Function for macros (Switch case)

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
What is the function for this macros below? What's the advantage for this?

Code:
#define MYCASE(_item,_id) \ 
   case _id: \ 
     _item##_##_id=_id;\ 
   break 

  switch(x) { 
      MYCASE(widget,23); 
  }

How can we add another..
- MYCASE(widget,24);
- MYCASE(widget,35);
- MYCASE(high,168);

and can we add more case in one MYCASE? Can you please rewrite the program and show it?

Thank You.

ThanK You
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top