C – Strset

C – Strset 2017-08-06T09:18:33+00:00

Strset() :

  • Strset() is one of many string functions available. For using string functions we need to include string library.In this function we pass 2 parameters namely a string and a character. When this function is called it will replace all the characters in the string by the specified character. While counting it will take blank spaces also.

Syntax :

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

strset(str,ch) set all character in str to ch. quits when the first null character is found. Returns a pointer to str.

C – STRING EXAMPLE PROGRAM :

Output :

Before :

str  : I LIKE C PROGRAMMING

strset(str,@):@@@@@@@@@@@@@@@@@@@@

After :

str : @@@@@@@@@@@@@@@@@@@@

Prev Next