9 Years
Discussion Span
Last Post by csurfer

get a menu choice from a user in the form of a character

e.g q to quit, s to save etc...

use a switch statement on the variable you used to hold the input

and for each possible value use a case statement and use a default statement for in the event they enter something you havent planned for


Whats the use of switch(ch) in c?

This is an irritating question; classified in the section that says: if you can not make use of a search engine and make a simple research on it, you don't have any business learning how to program.


switch is used to SWITCH between things or choices.

Both, the developers of C language and also the people on this forum are quite witty...so take their wise words and do some research on the topic first before posting a question...thats the only way to learn things in a programming language.(Especially C,try writing more programs).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.