C strset() Function

Last Updated:

C strset()

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

Example

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; }

Syntax

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

Parameter Values

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

Return Value

ValueExplanation
String Returns a string replaced by the given symbol.

Share this Page

Meet the Author