Westonci.ca makes finding answers easy, with a community of experts ready to provide you with the information you seek. Get quick and reliable solutions to your questions from a community of experienced professionals on our platform. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.

Write a function called changeCharacter that takes three parameters – a character array, its size, and the replacement character – to change every third character in the array to its replacement character

(C++ coding)

Sagot :

Method explanation:

  • Defining a method "changeCharacter" that takes three parameters that are "character array", and two integer variable "s, k" in its parameters.
  • Inside the method, a for loop is declared that takes array value and defines a conditional statement that checks the 3rd character value in the array, is used to the array that holds its key-value.
  • Please find the full program in the attachment.

Method description:

void changeCharacter(char* ar, int s, int k)//defining a method changeCharacter that takes three parameters

{

  for(int j = 1; ar[j]!='\0'; j++)//defining a for loop for 3rd character value in array  

  {

      if(j%3== 0)//use if block that check 3rd character value in array  

      {

          ar[j-1] = k; //Changing the 3rd character in array

      }

  }

}

Learn more:

Program: brainly.com/question/12975989

View image codiepienagoya