Showing posts with label PrOgRaMmInG. Show all posts
Showing posts with label PrOgRaMmInG. Show all posts

Monday, December 14, 2009

Why switch expression does not work with float types?

Have you people ever thought of why switch statement does not work with float/double types?
I have read in text books about the constraints of switch statements but i have never thought(infact i didnt take pain to find it out :P) why switch cant be used with floating point values,
but today one of my friend asked me about it(she is doing civil engg)as she has a viva tomorrow on c programming.I was not able to answer her immediately,i searched a lot and i found some answers.I would like to share it with everybody.
The reason is...