Hello people,
Whats the use of switch(ch) in c?
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.
See this page: http://www.cppreference.com/wiki/keywords/switch.
Google showed me this Web site in less than 1 second and it took that amount of time to see the content.
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).
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.