I want to replace each occurence of word example with word program
OUTPUT should be= this is a program, I like studying program
I have coded it, but some error is coming and i think there is come problem in my code.
Cn anybody suggest me smthng??
thank you
#include <stdio.h>
#include <string.h>
char replace(char[],char[],char[]);
void main()
{
char mystr[50] = "this is a example, I like studying example";
char old[]="example";
char neww[]="language";
char c[40]="\0";
clrscr();
puts(mystr);
//puts(replace(mystr[], old[], neww[]));
c=replace(mystr[],old[],neww[]);
//puts(c);
getch();
}
char replace(char mystrr[], char oldd[], char newww[])
{
int a,i,j;
a=strlen(mystrr);
for(i=0;i<a;i++);
{
int a,i,j;
a=strlen(mystrr);
for(i=0;i<a;i++);
{
for(j=0;j<(mystrr!=0);j++)
{
if(mystrr[i]==oldd[i])
{
mystrr[i]=newww[i];
}
}
}
//puts(mystrr);
return mystrr;

New Topic/Question
Reply



MultiQuote





|