I am writing the following code to find out the required strings are present in the given string, if found I would like to replace them with required. I tried as below, but for replacing I haven't done can some one help me
#include <stdio.h>
#include <string.h>
int main(void)
{
char *str;
const char text[] = "Hello atm adsl";
const char *arr[] = {"atm", "f/r", "pc","adsl"}; // If found I would like to replace them with Atm, F/R,PC,ADSL
int i=strlen(*arr);
for(int j=0;j<i;j++)
{
str=arr[j];
const char *found = strstr(text, arr[j]);
switch(str)
{
case "Atm":
break;
}
puts(found ? "found it" : "didn't see nuthin'");
return 0;
}
}
I am getting following error
invalid conversion from const char* to char*
and switch quantity not an integer
Can some one help me