100% switch program without break statement
// switch demo without using break statement
#include <stdio.h>
void main()
{
int i=4;
switch(i)
{
case 1: printf("\n satyamu paluku 1");
case 4: printf("\n directly this gets printed 4");
case 2: printf("\n this case 2 will also get printed bcoz there was no break statement in case 4 which is just above case2");
}
}
#include <stdio.h>
void main()
{
int i=4;
switch(i)
{
case 1: printf("\n satyamu paluku 1");
case 4: printf("\n directly this gets printed 4");
case 2: printf("\n this case 2 will also get printed bcoz there was no break statement in case 4 which is just above case2");
}
}
ఔట్పుట్ తెర మీద ఇలా ..
directly this gets printed 4
this case 2 will also get printed bcoz there was no break statement in case 4 which is just above case2
this case 2 will also get printed bcoz there was no break statement in case 4 which is just above case2
----
Now if we use break statement just at the end of case 1 and case 4, then ఔట్పుట్ తెర మీద ఇలా ..
directly this gets printed 4
ఆ తర్వాత switch నుండి బయటకు వచ్చేస్తుంది
కామెంట్లు
కామెంట్ను పోస్ట్ చేయండి
దయచేసి మీ సలహాలను సూచనలను స్పష్టంగా పేర్కొనగలరు. plz see that ur comments are 'acceptable' in a value based society.