strnset(): setting n chars of a string


We can set part of the chars of a string to one input string by using strnset() string function.
strnset(main_string, set_string,n);
#include<stdio.h>
#include<string.h>
int main()
{
   char str1[20] = "plus2net";
   char str2='*';
   printf("Original string : %s \n", str1);
   strnset(str1,str2,4);
   printf("After  strset() : %s",str1);
   return 0;
}
The output of above code is here
Original string :plus2net
After strnset() : ****2net

Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2021 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer