STRSET() Function – C Program

STRSET() Function – C Program

Write a C Program to sets all the character of string to given character.

STRSET() Function – The STRSET() Function used to sets all the character of string to given character in C Program.

The Syntax of STRSET() Function :

strset(str1,  ‘ * ‘) – All the character of string str1 replaced by character ‘ * ‘.

Example of STRSET() Function C Program

#include<stdio.h>
#include<string.h>
int main()
{
 
char str[100];
 
printf("Please, Enter the String = ");
gets(str);
 
printf(" \n The String after strset is = %s",strset(str, '*'));
 
return 0;
 
}

The output of STRSET() Function C Program is :

Please, Enter the String = Meera

The String after strset is = *****

 

Author: Meera Academy

Leave a Reply

Your email address will not be published. Required fields are marked *