Tech Study

List of Switch case programs with an examples

Switch case statements are an alternate method for long if statements that compare a variable to several ‘integral’ values. The value of the variable given into switch is compared to the value following each of the cases, and when one value matches the value of the variable, the computer continues executing the program at that point.

The basic format for using switch case is outlined below.

switch (n)
{
    case this-value:
        // code to be executed if n is equal to  this-value
        break;

    case this-value2:
        // code to be executed if n is equal to this-value2
        break;
        .
        .
        .
    default:
        // code to be executed if n doesn't match any of the cases
}

List of Switch case programs with an examples

TaggedList of Switch case programs with an examples

Java Final keyword

Introduction : java final keyword The final keyword present in Java programming language is generally used for restricting the user. …

Read more

C++ Memory Management: new and delete

C++ Memory Management We know that arrays store contiguous and the same type of memory blocks, so memory is allocated …

Read more