C user input ⌨️

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 52

  • @BroCodez
    @BroCodez  3 года назад +23

    #include
    #include
    int main(){
    char name[25]; //bytes
    int age;
    printf("
    What's your name?");
    //scanf("%s", &name);
    fgets(name, 25, stdin);
    name[strlen(name)-1] = '\0';
    printf("How old are you?");
    scanf("%d", &age);
    printf("
    Hello %s, how are you?", name);
    printf("
    You are %d years old", age);
    return 0;
    }

    • @thegamingpaul3743
      @thegamingpaul3743 3 года назад

      how about the birthdate?

    • @TodiDiang
      @TodiDiang Год назад +2

      How about this
      #include
      int main() {
      char input1[100];
      char input2[100];

      printf("Input 2 (without space): ");
      scanf("%s", input2);
      printf("Input 2: %s
      ", input2);

      // Clearing input buffer
      while (getchar() != '
      ');

      printf("Input 1 (with space): ");
      scanf("%[^
      ]", input1);
      printf("Input 1: %s
      ", input1);

      return 0;
      }
      My friend using that code

  • @annoyingprecision2487
    @annoyingprecision2487 Год назад +5

    This was a splendid lesson on user input in C. Thanks a ton.

  • @eeneemeenee6236
    @eeneemeenee6236 Год назад +1

    i like that u mention the gap in knowledge at certain parts

  • @TheScissorunner
    @TheScissorunner 2 года назад +3

    Great production quality with your videos!

  • @sreekaraitha6615
    @sreekaraitha6615 4 месяца назад

    Nice lecture

  • @shiwari1280
    @shiwari1280 3 года назад

    Thanks for the tutorials bro!

  • @fabiovictorino350
    @fabiovictorino350 3 года назад

    Very simple and good.

  • @not_pockchan3418
    @not_pockchan3418 3 года назад +1

    noice, the string format also doesn't seem to advanced, great teaching bro

  • @ShStepan
    @ShStepan 3 года назад +1

    fgets(); Which autocomplete do you use for that?

  • @pakapeta7772
    @pakapeta7772 2 года назад

    Very useful, cheers mate.

  • @azeedhazard7638
    @azeedhazard7638 2 года назад

    amazing bro👍

  • @The_Mad-Ramx
    @The_Mad-Ramx 7 месяцев назад

    Great

  • @t-ree
    @t-ree 3 года назад

    Thank You!!

  • @ghazihattab
    @ghazihattab 3 года назад

    ur the best :)

  • @nem0103
    @nem0103 2 года назад +1

    when i press run it direct to output and not terminal. how to run it??

  • @PektraNao
    @PektraNao 3 месяца назад

    I have an issue where when i run the code, power shell will run in the terminal but I won't see the print line so "How old are you?", instead of seeing the line right away. a new cmd window will pop out and display "How old are you?", then I will have to type the age, then when I type the age, the new window closes and then the question "How old are you?" is written in the terminal. then I have to re-enter the age and then it shows the message You are 21 years old. How can I fix the new window popping out? I did go on code runner to checkmark for the terminal.

  • @iasmin-i
    @iasmin-i 4 месяца назад +1

    How do you do, fellow kids!

  • @user-ace96plays
    @user-ace96plays 6 месяцев назад +1

    DONE❤

  • @SAEID-n4r
    @SAEID-n4r Год назад

    ❤❤❤❤

  • @thiemhoang3015
    @thiemhoang3015 3 года назад +1

    how can run in the black console like visual studio ??

  • @cadmium4113
    @cadmium4113 3 года назад

    Bro❤️

  • @MainulHossainAnik
    @MainulHossainAnik 2 месяца назад

    🔥🔥❤❤DONE🔥🔥❤❤

  • @MerryMerry632
    @MerryMerry632 Год назад

  • @harshitpandit188
    @harshitpandit188 3 года назад

    Hi bro. I've been watching Java tutorial from your series only.Please help me with the setup of Java in Visual Studio Code
    Also are you planning any series on android development ??

  • @pamlongwood4217
    @pamlongwood4217 Год назад

    legend

  • @vega_yy
    @vega_yy 8 месяцев назад

    printf("Random comment1.2");

  • @aditya_asundi
    @aditya_asundi 3 года назад

    Why vscode? Why not dev-c++, vs19 or codelite?

    • @BroCodez
      @BroCodez  3 года назад +1

      more people are transitioning to vscode

    • @Unit_00
      @Unit_00 3 года назад +7

      lmao and here I am using notepad

    • @dxshawn532
      @dxshawn532 Год назад

      Those are trash

  • @rezuwankabir3372
    @rezuwankabir3372 Год назад

    can you not just do scanf ("%s%s", &nameF, nameL) instead of using fgets?

  • @Onestonedbake
    @Onestonedbake Год назад

    wazzup bro code!!! im new to the community!!!

  • @Crimera137
    @Crimera137 Год назад

    am not 21 anymore but i pretend i still am!

  • @big_2361
    @big_2361 3 года назад

    he scanfs the string with an & and it works? how?

    • @redemedy8602
      @redemedy8602 3 года назад

      if you dont put it it will modify the pointer so...

    • @big_2361
      @big_2361 3 года назад

      @@redemedy8602 no not at all. with int or char variables you use & to get their address aka get a pointer to them and change the value at which the pointer points. if you assign a pointer to a pointer with & you will only change the pointer (you will change where it points to) and that will cause an error

    • @vincenzo3574
      @vincenzo3574 2 года назад +1

      It works because &array is equal to array in C, if he was using a pointer to a buffer allocated with malloc it would crash

  • @sashaktyadav7998
    @sashaktyadav7998 3 года назад

    I asked you a question that Which language is best for making mobile app than can control robots (Both iphone and android) ? Pls reply sir 🙏

  • @felipemrj.
    @felipemrj. 7 месяцев назад

    yoooooooooooo

  • @TheArturM
    @TheArturM 2 месяца назад

    DO IT

  • @engirckt5410
    @engirckt5410 3 года назад

    oh my god c is not like java at all lol

  • @yuhmi88
    @yuhmi88 3 года назад

    early!

    • @yuhmi88
      @yuhmi88 3 года назад

      thx for noticing!

  • @khahanguyen3059
    @khahanguyen3059 3 года назад

    how can run input in mac os, because it isn't like your video.

  • @fyrukmcoo100
    @fyrukmcoo100 3 года назад

    :((

  • @sashaktyadav7998
    @sashaktyadav7998 3 года назад +2

    I asked you a question that Which language is best for making mobile app than can control robots (Both iphone and android) ? Pls reply sir 🙏

    • @BroCodez
      @BroCodez  3 года назад +2

      Python with Kivy framework could work