ProAnswers.org

Write a C program to replace a given string with a given symbol?

#include

#include 

#include 

void main() 

{ 

char text[15]; 

char symbol; 

clrscr(); 

Puts(“Enter string”); 

gets(string); 

puts(“Enter symbol for replacement:”); 

scanf(“%c”, &symbol); 

printf(“Before strset(): %s

”, string);

strset(string, symbol); 

printf(“After strset(): %s

”,r, string);

getch(); 

} 

Output: 

Enter string: SAM 

Enter symbol for replacement: A 

Before strset(): SAM 

After strset(): AAA