title: Switch function in C does all the cases
body: <p>Okay so I'm writing a code for something and I've encountered a problem whilst testing switch function. It does all the cases incrementing from one's selection (my explanation). Could someone help me explain why is this so?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include "ratedzfunctions.h"
  
  int main()
  {
  
      int selection, loop=1;
      FILE* fajl;
  
      //Opening the participants file
      fajl=fopen("participants.txt","r+");
      if (fajl==NULL)
      {
          printf("The file cannot be opened.\n");
      }
  
      //MENU
      do 
      {
          printf("\nMENU: \n------------\n1. RATEDZ\n\n2. STATISTICS\n\n3. EXIT\n\n==&gt;");
          scanf("%d", &amp;selection);
  
          switch (selection)
          {
          case 1:
              ratedz(fajl);
          case 2:
              stats(fajl);
          case 3:
              loop=0;
          }
      }
  
      while (loop==1);
  
      fclose(fajl);
  
      return 0;
  }
  
  //THIS IS FROM RATEDZFUNCTIONS.H
  
  void ratedz(FILE *fajl)
  {
      printf("\nTEST RATEDZ");
  }
  
  void stats(FILE *fajl)
  {
      //Printing all participants
      char *buffer=(char*) malloc(50);
  
      while(fscanf(fajl,"%s %s %s", buffer)!=EOF)
      {
          printf("\n%s %s %s", buffer);
      }
  
      free(buffer);
  }
  </code></pre>