Best C Programming Code for several String related user defined functions (January,2021)

#include<stdio.h>

 void mstrcpy(char [],char []);//this function will copy one string into another
 int mstrlen(char []);// this function will find out the length of the string
 void mstrcat(char [],char []); // this function will concatenate two strings
 int main()
 {
     char str1[50],str2[50],str3[50];
     printf("\nEnter the string : ");
     gets(str1);
     printf("String length is %d",mstrlen(str1));
     mstrcpy(str1,str2);//str2=str1
     printf("After copy new version is : ");
     puts(str2);
     printf("\nEnter another string : ");
     gets(str3);
     mstrcat(str1,str3);//str1=str1+str3
     printf("After concatenation new version is : ");
     puts(str1);
 }

 void mstrcpy(char str1[],char str2[])
 {
     int i;
     for(i=0;str1[i]!='\0';i++)
        str2[i]=str1[i];
     str2[i]='\0';
 }

 int mstrlen(char str[])
 {
     int i;
     for(i=0;str[i]!='\0';i++);

     return i;
 }
void mstrcat(char str1[],char str2[])
{
    int i,j;
    for(i=0;str1[i]!='\0';i++);//self terminated loop

    str1[i++]=' ';
    for(j=0;str2[j]!='\0';j++)
        str1[i++]=str2[j];
    str1[i]='\0';
}

This Post Has 0 Comments

  1. website developer

    Hello there! I could have sworn I’ve been to this blog before but after reading through some
    of the post I realized it’s new to me. Anyhow, I’m definitely
    happy I found it and I’ll be bookmarking and checking back frequently!

    1. Kumar Gourab

      Thanks a lot for your comment … please share my blog with your near and dear ones… and please visit again…

  2. Faiz Israili SEO

    Hello! Do you know if they make any plugins to help with Search
    Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but
    I’m not seeing very good gains. If you know of any please share.
    Kudos!

  3. Your mode of describing all in this post is genuinely
    good, every one be capable of effortlessly know
    it, Thanks a lot.

    1. Kumar Gourab

      Thanx a lot for such a lovely comment .. I would like to request to share these blogs with your near and dear ones… thank you once again…

  4. Milagros

    Aw, this was a really nice post. Taking the time and
    actual effort to generate a very good article…
    but what can I say… I put things off a whole lot and
    don’t seem to get anything done.

    1. Kumar Gourab

      Thanx a lot for your reply… I will be looking forward to further communications….

  5. Connie

    Very nice article, totally what I needed.

  6. Dannielle

    Hey There. I discovered your blog the use of msn. This is a really well written article.
    I will make sure to bookmark it and return to learn more of
    your useful information. Thank you for the post.
    I’ll certainly return.

  7. Demi

    You’re so awesome! I don’t believe I’ve truly read a single thing like that before.

    So great to find another person with genuine thoughts
    on this topic. Really.. thanks for starting this up.

    This web site is something that is needed on the web,
    someone with some originality!

  8. Selena

    Excellent post. I will be facing some of these issues as well..

  9. Kathlene

    Wow that was strange. I just wrote an really long comment but after I clicked submit my comment didn’t show up.
    Grrrr… well I’m not writing all that over again. Anyway,
    just wanted to say wonderful blog!

  10. Lucienne

    My brother recommended I would possibly like this web site.
    He was totally right. This submit actually made
    my day. You cann’t believe simply how a lot time I had spent for this
    info! Thanks!

  11. Archer

    Nice post. I learn something totally new and challenging on blogs I stumbleupon everyday.
    It’s always interesting to read content from other writers
    and use something from other web sites.

Leave a Reply to Archer Cancel reply