C – Strnset

C – Strnset 2017-06-12T11:32:08+00:00

strnset()

Syntax :
#include<string.h>
char *strnset( const char *str,char ch ,int n);

strnset(str,ch,n) set the first n character of str to ch. quits when the first null character is found. Returns a pointer to str.

Example :

Output :

Before :

str  : I LIKE C PROGRAMMING

strnset(str,’@’,6)=@@@@@@ C PROGRAMMING

After :

str : @@@@@@ C PROGRAMMING

Prev Next