Untitled

 avatar
unknown
plain_text
3 years ago
576 B
10
Indexable
using namespace std;
int main()
{
    char string[] = "this is a !test s!tring";

    char c1 = 't';

    char c2 = 'X';


    cout << string << endl;

    //call function replace

    replace(&string[0], c1, c2);

    //rest if replace function works

    cout << string << endl;



}

void replace(char* s, char c1, char c2)
{
    

    char* s = &string[0];
    char c1 = 't';
    char c2 = 'X';

    s = s + 2;

    *s = 'a'; // Replace “S" with "a"

    *(s + 1) = 'a'; // Replace “T" with "a"


              
    return s;
}
Editor is loading...