switch Statements | C Programming Tutorial

Поділитися
Вставка
  • Опубліковано 9 лют 2025
  • An overview of how to use switch statements in C! Source code: github.com/por.... Check out www.portfolioc... to build a portfolio that will impress employers!

КОМЕНТАРІ • 14

  • @saidrafili262
    @saidrafili262 Рік тому +4

    Video about switch statement, but I learned a lot of cool things. Thank you, Sir!

  • @towtruckn
    @towtruckn 2 роки тому +2

    Kevin thanks for great video; I think a lot of people might skip over covering switch statements but as shown; by using fall through logic they can be very useful. I wrote the code out and included a default: section to keep track of consonants ie. ++consonants; that is presuming the random string only contains letters.

    • @PortfolioCourses
      @PortfolioCourses  2 роки тому +1

      Cool, that's a good example of using default. And I think switches are good to use as long as everyone editing the code is onboard with them and appreciates how they work, I've definitely noticed some folks either don't bother with them or are generally against using them. I'm glad you enjoyed the video Peter! :-)

  • @treklin1573
    @treklin1573 Рік тому +1

    STEP BY STEP TUTORIAL FOR LEARNERS.I appreciate your contribution.

  • @rezuwankabir3372
    @rezuwankabir3372 2 роки тому +1

    The explanation was really good.

  • @bhathiyaranasinghe6637
    @bhathiyaranasinghe6637 Рік тому

    One of the Best Explainers!

  • @stanleyhavok
    @stanleyhavok 2 роки тому +1

    exactly what I was looking for!

    • @PortfolioCourses
      @PortfolioCourses  2 роки тому

      Awesome, I’m glad it was helpful for you Stanley! :-)

  • @nhatan2511
    @nhatan2511 2 роки тому

    thank you so much

  • @idhemhyouka129
    @idhemhyouka129 Рік тому

    here is an easier example
    #include
    int main() {
    int day;
    printf("Enter a day of the week (1-7): ");
    scanf("%d", &day);
    switch(day) {
    case 1:
    printf("Sunday
    ");
    break;
    case 2:
    printf("Monday
    ");
    break;
    case 3:
    printf("Tuesday
    ");
    break;
    case 4:
    printf("Wednesday
    ");
    break;
    case 5:
    printf("Thursday
    ");
    break;
    case 6:
    printf("Friday
    ");
    break;
    case 7:
    printf("Saturday
    ");
    break;
    default:
    printf("Invalid input
    ");
    break;
    }
    return 0;
    }

    • @PortfolioCourses
      @PortfolioCourses  Рік тому +1

      We go over an easier example first at the start of the video! :-)