Video není dostupné.
Omlouváme se.

C Programming! scanf() VS fgets() VS gets() Which ones better?

Sdílet
Vložit
  • čas přidán 12. 08. 2024
  • PIEAS (Pakistan Institute of Engineering and Applied Sciences)

Komentáře • 23

  • @lautarocarrano6537
    @lautarocarrano6537 Před 5 lety +2

    Thanks bro, good explanation👍🏻👏🏻

  • @Nirala_414
    @Nirala_414 Před 3 lety

    Thank you, very helpful

  • @TIAGO543211
    @TIAGO543211 Před 5 lety

    thank you Minhaj!

  • @has9629
    @has9629 Před 4 lety +1

    thanks minhaj ur a certified beauty

  • @chiatiahnguea6623
    @chiatiahnguea6623 Před 2 lety

    Thanks for the video, it was great 👍

  • @xxdjmocoxx6297
    @xxdjmocoxx6297 Před 3 lety +1

    Thanks!

  • @rijoksd
    @rijoksd Před 2 lety

    Nice video bro 👍🏻👍🏻

  • @stonedcodingtom9097
    @stonedcodingtom9097 Před 2 lety

    Thx

  • @travelwithme4128
    @travelwithme4128 Před 3 lety +3

    chandigarh university wale like here

  • @zakijabbour9447
    @zakijabbour9447 Před 4 lety +7

    When using fgets in a loop, it doesn't take a new string, it scans from where it left in the previous string. Any idea how to solve that?
    Great video btw

    • @himanshurajpal7842
      @himanshurajpal7842 Před 3 lety +3

      Use fflush(stdin)

    • @questionmarc8
      @questionmarc8 Před 7 měsíci

      @@himanshurajpal7842 That is undefined behavior in both the C and POSIX standards, you can use this but your code will not be portable and behavior may change on a compiler update or with higher optimization levels on the same compiler.

    • @questionmarc8
      @questionmarc8 Před 7 měsíci

      My solution is to this code after calling fgets:
      if (buffer[strlen(buffer)-1] != '
      ') {
      int c;
      while ((c = getchar()) != '
      ' && c != EOF);
      }

  • @aakanshasoy3921
    @aakanshasoy3921 Před rokem

    gets ka kha tha isme ?

  • @jeffbezos3942
    @jeffbezos3942 Před 3 lety

    Is conio.h usefull?

  • @shambukarijayanth7120
    @shambukarijayanth7120 Před 4 lety +1

    What is the " _getch() " in the line above return 0 ? Quickly reply please.

    • @danielsantana6018
      @danielsantana6018 Před 4 lety +2

      wait a response from your keyboard

    • @het_mehta
      @het_mehta Před rokem

      Holds the output screen for sometime and it also hides like hide the input character entered by users in a password or an ATM.

  • @amanprajapati3417
    @amanprajapati3417 Před 4 lety

    What is the role of stdin there?

    • @alterego603
      @alterego603 Před 4 lety

      Stdin means read from 'standard input'. String uses array where you want to read the strings from

    • @vinayjain322
      @vinayjain322 Před 2 lety

      #include is header file

  • @AaronNevalinz
    @AaronNevalinz Před 4 lety +1

    you ended never use fgets, never use scanf functions. but if thats so whats your opinion? thanks sir anyways

    • @nikhilsastry6631
      @nikhilsastry6631 Před 3 lety +3

      Bruh....he said .....gets() & scanf() are worst working with string,........fgets() was recommended