我正在编写以下代码以找出给定字符串中存在所需的字符串,如果发现我想用所需的替换它们。我尝试如下,但是对于替换我还没有做有人可以帮助我
#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;
}
}
我收到以下错误
invalid conversion from const char* to char*
和switch quantity not an integer
有人能帮我吗