Answers for "switch case for character"

C
15

switch statement in c

#include <stdio.h>

int main(void)
{
  	int a = 0;
  
    switch(a)
    {
       case 1 :
          statement("a = 1");
          break;

       case 2 :
          printf("a = 2");
          break;

       default :
       	  printf("a is neither 1 or 2");
	      break;
    }
}
Posted by: Guest on September-07-2020
11

switch case c

switch (expression) {
    case constant1:
      // statements
      break;

    case constant2:
      // statements
      break;

    default:
      // default statements
}
Posted by: Guest on February-20-2020
0

switch case for character

char letter switch(int letter)
{
char res;
switch (letter)
{
case 0*41:
res= 'a\0';
break;
case 0*42;
res='b\0';
break;
case 0*43;
res='c\0';
break;
default:
res='z\0'
break;
}
return res;
}
Posted by: Guest on September-06-2021

Code answers related to "C"

Browse Popular Code Answers by Language