C strset() Function

Last Updated:

C strset()

The strset() replaces every character of a string with the symbol given by the programmer.


C Compiler
#include <stdio.h> #include <string.h> int main() { char str[20] = "Mask this text"; char ch = '*'; strset(str, ch); printf("str: %s ", str); return 0; }


char *strset(const char *str, char ch)

Parameter Values

str Required Specifies a string
ch Required Specifies a character by which the string is to be replaced.

Return Value

String Returns a string replaced by the given symbol.

Share this Page

Meet the Author