EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / i think you have used SWITCH

i think you have used SWITCH

|

Microcontroller › 8051 › what does these warnings mean???? › i think you have used SWITCH

March 4, 2012 at 4:20 pm #7246
phanindra nath
Participant

i think you have used SWITCH as follows-

 

switch(n)

{

 case v1: statements;

 case v2: statements;

 case v3: statements;

 case vn: statements;

 default: 

}

did you write code like above code?

if so then its WRONG because CASE identifiers should be CONSTANTs .

you cannot write “case v1”  because ‘v1’ is a variable.

 

instead you can write as 

 ……

  case 11: statements;

  case 12: statements;

…….

i hope you understand.

if you havesome time please check my blog

RSS Recent Posts

  • Sine wave distortion January 16, 2026
  • Flip Flop for My Mirrors January 16, 2026
  • potenciometer attachment / screwdriver January 16, 2026
  • flexible copper cable January 16, 2026
  • Variable audio oscillator January 16, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise