About The Experiment: Strings Are Actually One-Dimensional Array of Characters Terminated by A Null Character '/0'
About The Experiment: Strings Are Actually One-Dimensional Array of Characters Terminated by A Null Character '/0'
Design, Develop and Implement a Program in C for the following operations on Strings
Read a main String (STR), a Pattern String (PAT) and a Replace String (REP)
Perform Pattern Matching Operation: Find and Replace all occurrences of PAT in STR
with REP if PAT exists in STR. Report suitable messages in case PAT does not exist in
STR
Support the program with functions for each of the above operations. Don’t use Built-in
functions.
PROGRAM CODE:
#include<stdio.h>
SAMPLE OUTPUT:
RUN 1:
Enter a main string Test
Enter a pattern string Te
Enter a replace string Re
The resultant string is Rest
RUN 2:
Enter a main string
This is Data Structure lab Enter a pattern string Data Structure
Enter a replace string Data structure with C
The resultant string is
This is Data structure with C lab
RUN 3:
Enter a main string
This is Data Structure lab Enter a pattern string Date
Enter a replace string DATA
Pattern string NOT found