Here is the code I tried:
void check(char*, int);
int main(){
int len;
char* str="stack over flow";
len=strlen(str);
check(str,len);
getch();
return 0;
}
void check(char* str,int len)
{
char* arr;int i=0;
arr=(char*)malloc(sizeof(char)*len);
arr="over flow stack";
while(arr[i]!='')
{
str[i]=arr[i];//here the error is thrown
i++;
}
puts(str);
}
when I tried to print back elements of arr into str I'm getting error.