strnset(): setting n chars of a string
#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
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);
This article is written by plus2net.com team.
plus2net.com