answersLogoWhite

0

The switch/case statement in the c language is defined by the language specification to use an int value, so you can not use a float value. You can, however, convert the float into an int and use it, so long as the resulting values and functionality meet your functional requirements.

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Can an integer be 3 and a half?

No, an integer cannot contain a decimal place. Instead consider using a double or a float for decimals.


How does a float switch work to detect liquid levels in a tank or container?

A float switch works by using a buoyant float that moves up and down with the liquid level in a tank or container. When the liquid level rises, the float also rises, triggering a switch to turn on or off based on the position of the float. This allows the float switch to detect and indicate the liquid level in the tank.


How do you convert an integer into a text using C?

sprintf is the most common solution


How do you enter integer in python?

In Python, you can enter an integer using the input() function, which captures user input as a string. To convert this string to an integer, you can use the int() function. For example: user_input = input("Enter an integer: ") integer_value = int(user_input) This will convert the input string to an integer, assuming the user enters a valid integer.


How do you convert string to int in Java?

One can convert a string variable to an int variable in Java using the parse integer command. The syntax is int foo = Integer.parseInt("1234"). This line will convert the string in the parenthesis into an integer.


How does a float switch work to detect liquid levels in a tank?

A float switch works by using a buoyant object, called a float, that moves up and down with the liquid level in a tank. When the liquid level reaches a certain point, the float rises and triggers a switch to indicate that the tank is full or empty.


Is it possible to convert a string into integer without using any function in c?

Yes


What are the benefits of using a sump pump with a vertical float switch for basement waterproofing?

Using a sump pump with a vertical float switch for basement waterproofing offers benefits such as efficient water removal, reliable operation, and space-saving design. The vertical float switch helps in automatically activating the pump when water levels rise, preventing flooding and water damage in the basement.


How does a water tank float switch work to regulate the water level in a tank?

A water tank float switch works by using a buoyant float that moves up and down with the water level in the tank. When the water level rises, the float also rises, triggering a switch to turn off the water supply. When the water level drops, the float lowers, turning the switch back on to refill the tank. This helps regulate the water level in the tank automatically.


How do I properly connect the float switch wire to the electrical system?

To properly connect the float switch wire to the electrical system, first ensure the power is turned off. Then, strip the wire ends and connect them to the corresponding terminals on the electrical system using wire connectors. Finally, secure the connections and test the float switch to ensure it is functioning correctly.


How do float switches work to detect liquid levels in a tank or container?

Float switches work by using a buoyant object, like a float, that moves up and down with the liquid level in a tank. When the liquid level rises, the float also rises, triggering a switch to turn on or off based on the position of the float. This switch then signals the liquid level to a control system, indicating whether the tank is full or empty.


How do you find by program a given number is integer or float?

If it contains a decimal point or an exponential part, then it should be handled as a float (or double).You can determine an existing variable's type in C using the type() function