UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

Is a default case necessary in a switch statement?

Asked by Last Modified  

Follow 1
Answer

Please enter your answer

Training Centre

NO, default is optional and you can omit it if there is no use of it.
Comments

Technology expert

Yes.If non of the conditions matches with the case ,it has to goto default.
Comments

Computer & Maths Professor

No it is optional
Comments

Doing mathematics & computing from IIT Delhi

No.
Comments

VKTechnology

no
Comments

B.Tech

when you want to execute default set of statements you will use default case.Its not mandatory.depends based upon program rerquirement.
Comments

I am a teacher.

default in switch is not mandatory. But its good practice to have default in code, in case if you decided default behavior of the logic when above cases doesn't match. As well it is useful, if the value being matched is decided at run time. For e.g. share price, petrol price, temperature etc.. In these...
read more
default in switch is not mandatory. But its good practice to have default in code, in case if you decided default behavior of the logic when above cases doesn't match. As well it is useful, if the value being matched is decided at run time. For e.g. share price, petrol price, temperature etc.. In these cases, its better to have default case, as you can't predict the fixed value in advance while writing program. Hope you understood. You can come back if you still need more clarifications. read less
Comments

Tuition Teacher

No But for good programming default is put to handle default actions and to catch any unexpected value.
Comments

Tutor

If there is no default: label and none of the case labels match the "switched" value, then none of the controlled compound statement will be executed.
Comments

Tutor

Yes
Comments

View 13 more Answers

Related Questions

Can include files be nested?
one line can only include one directory. No nesting is applicable.
Himangi
0 0
7
What is the difference between ++var and var++?
First one is present increment and second one is the post incremental t of the variable. Both increases value of var to one. The difference between pre and post increment is given in below example. Int...
Chittaranjan
What are the functions in C programming?
Functions in C are the basic building blocks of a C program. A function is a set of statements enclosed within curly brackets ({}) that take inputs, do the computation, and provide the resultant output....
Kiran
0 0
6
Is it necessary to mention the header files in the C programming language?
yaa !!!!! it is necessary because we need the data present in evey header file...like example we can do mathematical calculations with the help of math header file.
Hari

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Storage classes in c
Storage classes determine the scope and life time of a variable. Scope is defined as the region over which the defined variable is accessible. Lifetime is the time during which the value of a variable...

Why C is a Language and not a database?
When I interviewed a candidate, I raised this question many times, but I have not got the answer correctly. To under why C is a language and not a database, it is good to understand why our communication...

C-Program Swapping Contents Of Variables Using Function [Call By Reference Method]
//Header Files #include#include // User defined functions swap with 2 pointer variables passed as an argument list void swap(int*i,int*j){ // Local variable temp int temp; // swapping contents using...

Recursion in C Programming
The process of calling a function by itself is called recursion and the function which calls itself is called recursive function. Syntax of Recursive Function returntype recursive_func () { statements; ...
R

Ravindra Yadav

2 0
0

Efficient Learning Strategies
Type your notes after class Write your notes onto flashcards - Scrabble -Make posters Review flashcards while walking, at gym, etc. Dog-ear pages in the reading where you can find...

Recommended Articles

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more