Remove Spaces from String | Logical Programming in C | Naresh IT

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ส.ค. 2024
  • ** For Online Training Registration: goo.gl/r6kJbB ► Call: +91-8179191999
    Subscribe to our channel and hit the bell 🔔🔔🔔 icon to get video updates.
    💡 Visit Our Websites
    For Classroom Training : nareshit.in/c-...
    For Online Training : nareshit.com/c...
    --------------------------
    💡 About NareshIT:
    "Naresh IT is having 14+ years of experience in software training industry and the best Software Training Institute for online training, classroom training, weekend training, corporate training of Hadoop, Salesforce, AWS, DevOps, Spark, Data Science, Python, Tableau, RPA , Java, C#.NET, ASP.NET, Oracle, Testing Tools, Silver light, Linq, SQL Server, Selenium, Android, iPhone, C Language, C++, PHP and Digital Marketing in USA, Hyderabad, Chennai and Vijayawada, Bangalore India which provides online training across all the locations
    --------------------------
    💡 Our Online Training Features:
    🎈 Training with Real-Time Experts
    🎈 Industry Specific Scenario’s
    🎈 Flexible Timings
    🎈 Soft Copy of Material
    🎈 Share Videos of each and every session.
    --------------------------
    💡 Please write back to us at
    📧 us.training@nareshit.com/ 📧 online@nareshit.com or Call us at the USA: ☎+1404-232-9879 or India: ☎ +918179191999
    --------------------------
    💡 Check The Below Links
    ► For Course Reg: goo.gl/r6kJbB
    ► Subscribe to Our Channel: goo.gl/q9ozyG
    ► Circle us on G+: plus.google.co...
    ► Like us on Facebook: / nareshit
    ► Follow us on Twitter: / nareshitek
    ► Follow us on Linkedin: goo.gl/CRBZ5F
    ► Follow us on Instagram: goo.gl/3UXYK3

ความคิดเห็น • 40

  • @onurinancdogruyol5223
    @onurinancdogruyol5223 5 ปีที่แล้ว +8

    Two spaces can exist adjacently, to overcome this problem we must put i--; in the if statement's body.

    • @vivekvikram4866
      @vivekvikram4866 4 ปีที่แล้ว +1

      Can u provide the code please
      I also have same priblem

  • @kishorep6852
    @kishorep6852 4 ปีที่แล้ว +6

    Sir you already said in strings handling videos part 2 ..that strlen function gives the length of the string " Excluding null character" But in this you explained that alternatively...which one is correct sir...🤔🤔

    • @ramadevimadaka7832
      @ramadevimadaka7832 4 ปีที่แล้ว

      Same doubt for me also before what he said strlen is use to give string length excluding null but in this vedio he is considering with null character also😳😳

    • @chayank9759
      @chayank9759 3 ปีที่แล้ว

      @@ramadevimadaka7832 I guess array is with null character but string length is with null character

    • @vinaykumarreddy9956
      @vinaykumarreddy9956 3 ปีที่แล้ว

      length is 5(excluding null)
      size is 6(including null)

    • @bulliraju5439
      @bulliraju5439 3 ปีที่แล้ว

      Same doubt for me
      But the stringlen will give without counting null . The program is crt

  • @kamaleshs537
    @kamaleshs537 4 ปีที่แล้ว +2

    Bro,keep putting more videos,u are clear explainer...thank you so much

  • @prathishm510
    @prathishm510 3 ปีที่แล้ว +2

    There is a error in the code if we simply use strlen after we get the input through scanf function where the string has spaces the string length will be only upto the character before the spaces. eg for ( a space b) strlen will be only 1 not 3.

  • @khushpatel9983
    @khushpatel9983 2 ปีที่แล้ว +1

    nice explanation

  • @manjunadhareddysithara922
    @manjunadhareddysithara922 7 หลายเดือนก่อน +2

    #include
    #include
    int main() {
    char inputString[100], outputString[100];
    int i, j;
    printf("Enter a string with spaces: ");
    fgets(inputString, sizeof(inputString), stdin);
    for (i = 0, j = 0; inputString[i] != '\0'; i++) {
    if (inputString[i] != ' ') {
    outputString[j++] = inputString[i];
    }
    }
    outputString[j] = '\0';
    printf("String without spaces: %s
    ", outputString);
    return 0;
    }
    its the correct code for this question

  • @Suniyedekhiye
    @Suniyedekhiye 5 ปีที่แล้ว +2

    Great explaination Sir
    Thank you so much Sir
    🙏🙏🙏🙏🙏🙏🙏🙏

  • @dspdev4276
    @dspdev4276 3 ปีที่แล้ว

    Hiii sir .....
    Tq Soo much sir .... E videos naku chalaaa help indi..
    Sir meru '.net ' cheputaraa....?

  • @Raam1827
    @Raam1827 ปีที่แล้ว +1

    I think strlen function returns the length of the string except null character

  • @nischay9385
    @nischay9385 11 หลายเดือนก่อน

    Ty sir great explanation, was looking for this❤

  • @everythingishere4680
    @everythingishere4680 4 ปีที่แล้ว +2

    everything was perfect but strlen does not count null character so the lenght would be 5 only

  • @nirupomchowdhury4699
    @nirupomchowdhury4699 2 ปีที่แล้ว

    great explanation and more effeftive video in youtube .🤟🏼🤟🏼

  • @madhurimadas9635
    @madhurimadas9635 3 ปีที่แล้ว +1

    Sir how to shift hyphen to front of the string? Please make a video of this. I'm giving an example:
    input: hello-hi-there
    output: --hellohithere
    PLease please make a video of this.

  • @saddamahmad2310
    @saddamahmad2310 5 ปีที่แล้ว +1

    thank you very much sir for this video

  • @ESSharath
    @ESSharath 4 ปีที่แล้ว +3

    Code is wrong

  • @DHANUSHrockyartist
    @DHANUSHrockyartist 5 ปีที่แล้ว

    great explaination. cool and chill

  • @raveenak8581
    @raveenak8581 3 ปีที่แล้ว +2

    Sir,
    What will happen if there is 2 or more adjacent spaces?
    Please explain sir

    • @VoxrPret
      @VoxrPret ปีที่แล้ว

      wo dekhte hi i opened comments. yes its true program there will fail

  • @emina4627
    @emina4627 3 ปีที่แล้ว

    Thank you so much!!!

  • @sadmanhafij
    @sadmanhafij 10 หลายเดือนก่อน +1

    #include
    #include
    int main() {
    char input[100], output[100];
    int i, j;
    printf("Enter a string: ");
    gets(input);
    for (i = 0, j = 0; i < strlen(input); i++) {
    if (input[i] != ' ') {
    output[j] = input[i];
    j++;
    }
    }
    output[j] = '\0';
    printf("String without spaces: %s
    ", output);
    return 0;
    }

    • @kunaltoke1550
      @kunaltoke1550 3 หลายเดือนก่อน

      Correct code

  • @hitesh1800
    @hitesh1800 ปีที่แล้ว

    please use some dark marker

  • @sarveshsawant1666
    @sarveshsawant1666 2 ปีที่แล้ว

    This code doesn't work for two or more spaces in between string or at start for eg. if a string is : i am a student then output is : i amastudent ....
    one space is still present. kindly provide solution for this.

  • @shaiknoorul63
    @shaiknoorul63 20 วันที่ผ่านมา

    Wrng for loop conditions
    Bro check once

  • @TrickyTech145
    @TrickyTech145 4 ปีที่แล้ว

    write a function to remove slash from two string and call that function from strcmp function and compare it in c programming??

  • @nikhileshyoutube4924
    @nikhileshyoutube4924 5 ปีที่แล้ว

    Sir do a video on string rev without using string functions

    • @justvectorthings4138
      @justvectorthings4138 4 ปีที่แล้ว

      #include
      #include
      int
      main() {
      int i,j;
      int s;
      int a[5];
      printf("enter five numbers");
      for(i=0;i=0;j--)
      printf(" %d",a[j]);
      }
      Take the help of this logic

  • @MuhammadAsif-wh9yx
    @MuhammadAsif-wh9yx 5 ปีที่แล้ว

    well explained

  • @siddharathasoam5699
    @siddharathasoam5699 3 ปีที่แล้ว

    Gets function is not allowed in c sir

  • @tushar3575
    @tushar3575 4 ปีที่แล้ว +1

    Not working

  • @aurajkyabnahai
    @aurajkyabnahai 5 ปีที่แล้ว

    Sir achha marker use kiya kijiye plzz

  • @chsantosh6
    @chsantosh6 3 ปีที่แล้ว +1

    I have done this using a continue function which reduces time and easy logic.
    char a[100],i;
    printf("Enter a string
    ");
    gets(a);
    for(i=0;a[i]!='\0';i++)
    {
    if(a[i]==' '&&a[i+1]==' ')
    continue;
    printf("%c",a[i]);
    }

  • @anugnagunturu2478
    @anugnagunturu2478 4 ปีที่แล้ว

    there is a small mistake in the code