Which control structure is faster?



Which control structure is faster inside a loop (for, while or do-while)?
1)----------------------------------------------------------

       switch(x)
       {
              case 1:
              {
                  .....    ;
                  break;
               }
               case 2:
               {
                  ....    ;
                  break;
               }
        }

2)---------------------------------------------------------


         if(x = = 1)
         {
               ........ ;
               break;
         }
         if(x = = 2)
         {
               ........;
               break;
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]