#21 C Strings | C Programming For Beginners

Поділитися
Вставка
  • Опубліковано 21 лип 2024
  • #21 C Strings | C Programming For Beginners
    In this video, we will learn about strings in C. With many examples we will show you how to can create strings. Then we will learn to take String input and we will also show you how we can access and change each character of the string using indexes in C programming.
    This video is a part of our C Programming video series: • #1: Getting Started wi...
    ~
    Resources:
    C Online Compiler: www.programiz.com/c-programmi...
    Github File: github.com/programiz/c-youtub...
    C (title) Tutorial (text-based tutorial): www.programiz.com/c-programmi...
    Timestamps:
    00:00 Start
    00:16 C Strings
    02:45 String Input
    05:58 Access Characters of a String
    07:49 Change Characters of String
    9:12 Programming Task
    9:54 Quiz
    ~
    Revise your learning using our C App
    Download here for Android: bit.ly/3upaInx
    Download here for iOS: apple.co/3EZLtNq
    Find Programiz elsewhere:
    Programiz pro: programiz.pro
    Website: www.programiz.com
    Discord: discord.gg/programiz
    Facebook: / programiz
    Instagram: / _programiz
    LinkedIn: / programiz
    Twitter: / programiz
    #programiz #cstrings #cprogramming #learnc #strings #array #index #Cstring

КОМЕНТАРІ • 207

  • @programizstudios
    @programizstudios  2 роки тому +10

    🔥Finding it Damn Hard to Understand C Programming?
    Learn to code-the right way-with interactive lessons, quizzes & challenges. Build a strong programming base; it's IMPORTANT!
    Try Programiz PRO for Free: bit.ly/master-c-programming

    • @AbhiramDeshpande-fe1vi
      @AbhiramDeshpande-fe1vi Рік тому +2

      #include
      int main() {
      char str[50];
      printf("enter your name :");
      fgets(str,sizeof(str),stdin);
      str[0]='X';
      printf(" new name :%s",str);
      return 0;
      }

  • @nurshafiqah3008
    @nurshafiqah3008 Рік тому +28

    Currently studying for tmr's programming test. I had a hard time trying to understand C programming until I found this channel. Thank you!

  • @harshaharsha9995
    @harshaharsha9995 2 місяці тому +2

    last week i went for an interview in a core company and they told me to learn C programming so this channel helps me a lot.

  • @Peter_1986
    @Peter_1986 9 місяців тому +11

    I am currently doing lab assignments in a course about C programming, and these videos are really great "lectures";
    I actually enjoy them a lot more than my official lectures for the course, haha.

  • @programizstudios
    @programizstudios  2 роки тому +17

    Timestamps:
    00:00 Start
    00:16 C Strings
    02:45 String Input
    05:58 Access Characters of a String
    07:49 Change Characters of String
    9:12 Programming Task
    9:54 Quiz

  • @ticklemecolor
    @ticklemecolor 2 роки тому +6

    Thank you for the clear and simple demonstration. getline() was not the right function to use and you helped me see that. Cheers!

  • @stealthy_doctor2384
    @stealthy_doctor2384 Місяць тому +1

    Wonderful intro to strings in C, for the quiz because its using scanf and not fgets it will only have C. "Jack "
    and this is the code practice
    #include
    int main() {
    // Write C code here
    char str[20];

    printf("Enter your name: ");

    fgets(str, sizeof(str), stdin);//this will get the entier input with spaces
    str[0] = 'X';

    printf("%s",str);

    return 0;
    }

  • @UniqueJean585
    @UniqueJean585 7 місяців тому +1

    This series of video helps me to understand C language more and the content was very explainable and entertaining. Thank you so much Programiz! #HighlyRecommend

  • @manirulmolla6105
    @manirulmolla6105 Рік тому +2

    Content is explained very clearly! The video was really useful 🥰

  • @naomywitherwhy129
    @naomywitherwhy129 Рік тому +3

    #include
    int main() {
    char str[30];
    printf("enter your name");
    fgets(str, sizeof(str), stdin);// replaces scanf, its role its to take input till the end of line
    str[0] = 'X';
    printf("%s ", str);//accessing the i in naomi using string index
    printf("%c ",str[4]);
    return 0;//fgets function str- name of string.sizeof the strinf, second parameter, stdin means standard input typed in from keyboard
    }

  • @earthquakenationz
    @earthquakenationz 2 роки тому +7

    If there's an ad runnning on the video, let them run the entire ads, just let it feels like you are watching on TV, and there are ads on it, through these we can help them, after all, we learn from these guys, for free....

    • @pravyjha4567
      @pravyjha4567 2 місяці тому

      Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls

  • @user-nt4nm4fb3u
    @user-nt4nm4fb3u 6 місяців тому +1

    Very good explanation...keep doing it. Thank you Programiz.

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

    I appreciate this channel. My college teachers don't teach programming and they send us to teach ourselves with reading text books and marking our tests and workshops.

  • @kimzitalks
    @kimzitalks 2 роки тому +6

    Love your videos! Helps me a lot.

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

    Thank you, you are a hero!

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

    Thank you very much for your helpful videos, I’m currently taking C programming and your videos are the best tools for me to study. Also, who doesn’t like to watch a beautiful woman teaching C, you are absolutely gorgeous!

  • @fire_with_rishi
    @fire_with_rishi 2 роки тому +9

    Answer wil be "jack"

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

    Ohhhhh
    What a content
    Good place in good time

  • @user-zq5tw9ur9g
    @user-zq5tw9ur9g Рік тому

    so helpfu, thank you very much!

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

    Thanks Alot Sister❤️

  • @pravyjha4567
    @pravyjha4567 2 місяці тому

    Can somebody pls tell me that while printing string we dont use ampersand so how come in the Uiz que she uses ampersand in the printf statement and the answer is Jack????? Pls

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

    Mam yaha pr "string" jo hai vo " constant" ka part hai to token ka part kaise ho sakta or ye koi dusara string hai. Please explain me 🤔🤔🤔

  • @nanimg3512
    @nanimg3512 2 роки тому +5

    Thanks a lot 🥺🥺🥺

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

    Amazing 😍😍😍

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

    Great video!!

  • @JaswinderSingh-Phy
    @JaswinderSingh-Phy 2 роки тому +1

    NICE CONTENT ♥️👌

  • @thisistusharmahajan
    @thisistusharmahajan 2 роки тому +13

    Programming Task :
    #include
    int main(){
    char name[20]="Tushar Mahajan";
    printf("enter your name:");
    fgets(name, sizeof(name), stdin);
    printf("%s",name);
    name[0]= 'X';
    printf("%s",name);
    return 0;
    }

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

      Hello, I need your help with a question.

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

      Consider P(x)=anxn+...........+a1x1+a0
      Write a program that gets from the keyboard coefficients values an,..........,a0 and stores them in a table of floating type of dimension 5 .
      The integer n and the real x are also introduced from the keyboard
      Calculate P(x).
      I need an answer as soon as possible.

    • @pravyjha4567
      @pravyjha4567 2 місяці тому

      Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls

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

    Omg thank youu 😍

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

    💗thank you so much .....

  • @One_piece1089
    @One_piece1089 11 місяців тому

    amazing teacher😍

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

    Love it!

  • @mohammadabdullahaalforhad1375
    @mohammadabdullahaalforhad1375 6 місяців тому

    Thanks a lot

  • @dhanalakshmisasanapuri-vf4fs

    Mam adding two matrix program explainations

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

    Why we are int main in function

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

    Thank you

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

    thanks!

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

    ur complier is some wht different from another c compliers!!!#include
    int main(){

    char name[100];
    scanf("%s", &name);
    printf("%s",name);
    return 0;
    }
    it taking & in strings !!!

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

    Great veido...

  • @Ckjohn77kg
    @Ckjohn77kg 8 місяців тому +6

    Be aware to use ' ' instead of " " !!

    • @pravyjha4567
      @pravyjha4567 2 місяці тому

      Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls

  • @user-pw8pb5ql6z
    @user-pw8pb5ql6z 5 місяців тому

    (jack)output as the user provided space in between user input

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

    nice

  • @smithdeon5800
    @smithdeon5800 6 місяців тому

    I have a doubt, can i decide the size of array like she used it in here as char str [20]; is there any problem in changing the size to 30 or 40, plz anyone reply😢

    • @TAMILSELVANK-hv7vu
      @TAMILSELVANK-hv7vu 5 місяців тому

      no its no problem in changing the size

    • @pravyjha4567
      @pravyjha4567 2 місяці тому

      Can somebody pls tell me that while printing string we dont use ampersand so how come in the Uiz que she uses ampersand in the printf statement and the answer is Jack????? Pls

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

    good

  • @freehug071
    @freehug071 Рік тому +2

    #include
    int main(void)
    {
    char mube[25];
    printf("Enter your name: ");
    fgets(mube, sizeof(mube), stdin);
    mube[0] = 'X';
    printf("%s", mube);
    return 0;
    }

    • @pravyjha4567
      @pravyjha4567 2 місяці тому

      Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls

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

    Support!!!!

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

    Thanks Madam...

    • @pravyjha4567
      @pravyjha4567 2 місяці тому

      Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls

  • @eejaaspk
    @eejaaspk Рік тому +3

    int main(void)
    {

    char name[20]; // declaring the array of characters
    // Displaying the name to enter
    printf(" Enter your name :

    ");
    // Storing the name to enter in the address of the array
    fgets(name, sizeof(name), stdin );
    name[0] = 'X'; // We want to replace the value of the first letter in the name by X ( index 0 )
    // we want to display the characters (name) with the first letter replaced by X
    printf("%s

    ", name);
    return EXIT_SUCCESS;
    }

  • @mhmadzaiter12
    @mhmadzaiter12 2 роки тому +4

    Consider
    P(x)=anxn+...........+a1x1+a0
    Write a program that gets from the keyboard coefficients values an,..........,a0 and stores them in a table of floating type of dimension 5 .
    The integer n and the real x are also introduced from the keyboard
    Calculate P(x).
    I need an answer as soon as possible.

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

      Do you have time left?

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

      #include
      int main(){
      int n, i;
      float P, a, x, xn;
      printf("Input n: ");
      scanf("%d", &n);
      printf("Input x: ");
      scanf("%f", &x);
      P=0.0;
      xn=1.0;
      for(i=0; i

    • @himanshusingh5214
      @himanshusingh5214 2 роки тому +5

      You can also use this:
      #include // Include the standard(std) input(i) output(o) library header file for your program
      #define _v(var) a##var
      /* a C macro which which can be used to give names to our coefficients from a0 to an, we won't be using it now as it is not needed and could be ignored
      Search online to learn about C macros (preprocessors)
      */
      //Main function start below which will run when we run the code
      int main(){
      // integer n will store the value of input n, and i will be used for loop
      int n, i;

      /* P will store the sum a0x0 + a1x1 + ... + anxn
      x will store the value of input x
      */
      float P, x, xn;
      printf("Input n: ");
      scanf("%d", &n);
      printf("Input x: ");
      scanf("%f", &x);
      float a[n]; // we take an array of size n which will store our coefficients a0 to an, this is not needed but we will use it.
      P=0.0;
      xn=1.0;
      for(i=0; i

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

    More video

  • @programizstudios
    @programizstudios  2 роки тому +14

    Q. What will be the value of the name variable if we provide Jack Sparrow as input value?
    char name[20];
    scanf("%s", &name);
    A. Jack Sparrow
    B. Sparrow
    C. Jack
    D. Error

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

    The answer is Jack
    #include
    int main(){
    char name[20];
    printf("Enter Name: ");
    scanf("%s", &name);
    printf("%s", name);
    return 0;
    }
    The output is Jack

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

    Answer : C (Jack)

  • @light-warrior
    @light-warrior 5 місяців тому

    task:
    #include
    int main() {
    char string[20];
    printf("Enter your name:
    ");
    fgets(string, sizeof (string), stdin);
    string[0] = 'X';
    printf("%s", string);

    return 0;
    }
    I assume, it would be an error as there is no printf function there...

    • @pravyjha4567
      @pravyjha4567 2 місяці тому

      Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls

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

    👏👏👏

  • @mallidiravindra8279
    @mallidiravindra8279 2 роки тому +4

    option D

    • @earthquakenationz
      @earthquakenationz 2 роки тому +3

      because of the ampersand?

    • @pravyjha4567
      @pravyjha4567 2 місяці тому

      Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls

  • @thisistusharmahajan
    @thisistusharmahajan 2 роки тому +3

    ans C : jack

  • @18fatima15
    @18fatima15 6 місяців тому +2

    quiz answer:
    C. Jack
    (P.S. You can check and confirm using the compiler)

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

    Error

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

    error bcoz in scanf & is given to str

    • @TiTan-gr3pv
      @TiTan-gr3pv 11 місяців тому

      No dude the output will not lead to an error . Just as you mentioned in the last case for str it worked because it was the name of the string and here the name of the string is name and hence both actually are doing the same thing but with a different face

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

    C is the answer

  • @paneccii
    @paneccii 9 місяців тому

    error?

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

    i think u gtot some knowledge that
    must be shared

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

    ❤❤❤

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

    Error is the correct answer for this last question

  • @km.originals9603
    @km.originals9603 2 роки тому +1

    Please provide videos for c++ programming

  • @sawewfelipe7480
    @sawewfelipe7480 Місяць тому

    answer is C, Jack

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

    " Your smile😀 is so, Beautiful, so keep smiling always 😁😋"

  • @aderolearnsengineering
    @aderolearnsengineering 9 місяців тому +1

    D. Error

  • @Code_with_affan
    @Code_with_affan 6 місяців тому

    Option C. JACK

    • @pravyjha4567
      @pravyjha4567 2 місяці тому

      Can somebody pls tell me that while printing string we dont use ampersand so how come in the Quiz que she uses ampersand in the printf statement and the answer is Jack????? Pls

  • @aboutouruniverse3834
    @aboutouruniverse3834 Рік тому +8

    Programing task:
    #include
    int main() {
    char ita [50];
    printf("what is my name: ");
    fgets(ita, sizeof(ita), stdin);
    ita[0] = 'x';
    printf("%s", ita);
    return 0;
    }

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

    /*
    Create a program that takes your fullname as
    input and prints your name.Then, change the
    first letter of your name to X.
    * If your name is John Williams, it will become
    Xohn Williams.
    * If your name is Julie Bing, it will become Xulie
    Bing.
    */
    #include
    int main(){
    char name[100];
    printf("Enter your name: ");
    fgets(name, sizeof name, stdin);
    printf("
    ");
    printf("%s
    ", name);
    name[0] = 'X';
    printf("%s
    ", name);
    return 0;
    }

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

    Return "CHEERRIO" 😂😂😂

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

    answer of last question is error

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

    4. Error

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

    Quiz Answer is Jack

  • @codeforcoder1
    @codeforcoder1 6 місяців тому

    Only Jack is printed

  • @mohammadabdullahaalforhad1375
    @mohammadabdullahaalforhad1375 6 місяців тому

    Programming Task :
    #include
    int main()
    {
    char name[30];
    printf("Enter the name: ");
    fgets(name, sizeof(name), stdin);
    name[0] = 'X';
    puts(name);
    return 0;
    }

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

    and you type in return "CHEEERIO" LMAOOO 🤣🤣🤣🤣

  • @xxxegster6527
    @xxxegster6527 9 місяців тому

    Quiz answer is c

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

    Quiz: C

  • @allanmark922
    @allanmark922 7 місяців тому

    The answer is Jack

  • @yogithabale
    @yogithabale 19 днів тому

    opt c , jack

  • @DpsBoys366
    @DpsBoys366 11 місяців тому

    Answer b

  • @doha__4710
    @doha__4710 2 місяці тому

    Programing quiz andlswer : jack

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

    Quiz = C

  • @alishan021
    @alishan021 11 місяців тому

    answer of quiz is :
    jack

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

    #include
    int main (){
    char str[20];
    printf("Enter your Name:");
    scanf("%s", str);
    str[0] = 'X'; // it allows us to create the first name is 'X' .
    printf("%s", str);
    return 0;
    }

  • @preethamepuri
    @preethamepuri 10 місяців тому

    John

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

    #include
    int main() {
    char str[20];
    printf("Enter your name: ");
    fgets(str, sizeof(str), stdin);
    str[0] = 'X';
    printf("Your name is %s", str);
    }

  • @JaswinderSingh-Phy
    @JaswinderSingh-Phy 2 роки тому +1

    JACK

  • @shivamchauhan1416
    @shivamchauhan1416 Рік тому +2

    //C program to print Name and replace first character with X
    #include
    int main() {
    // Write C code here
    char str[30];
    printf("Name: ");
    fgets(str, sizeof(str), stdin);
    printf ("%s", str);
    str[0] = 'X';
    printf("
    %s", str);
    return 0 ;
    }

  • @One_piece1089
    @One_piece1089 11 місяців тому

    the answer is "C"

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

    quiz ans: C

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

    The answer is C.

  • @sandeepvarma8453
    @sandeepvarma8453 3 місяці тому

    c.jack

  • @siyabongamtambo2501
    @siyabongamtambo2501 4 місяці тому

    mhmm

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

    Jack

  • @KpopRumbleAlliance
    @KpopRumbleAlliance 3 місяці тому

    jack

  • @piashhasaninfo
    @piashhasaninfo 10 місяців тому

    #include
    int main()
    {
    char str [] = "Piash";
    str [0]= 'X';
    printf("%s",str);
    return 0;
    }

  • @riyashah1161
    @riyashah1161 Місяць тому

    error