Write a program that has a declaration in main() to store the string \"Vacation\
ID: 3637343 • Letter: W
Question
Write a program that has a declaration in main() to store the string "Vacation" i near in an array named message. Also, add a function callto display() that accepts message in an argument named strng and then displays the contents of message by using pointer notation *(strng + i), then modify the display() function to use the expressions *strng rather than *(strng + i). The program I compiled from this question is listed below, I am struggling with placements of notations on the latter part of the question.#include <iostream>
using namespace std;
int main(){
void dispstr(char*);
char str[] = "Vacation";
display(str);
return 0;
}
void display(char* ps)
{
while( *ps )
cout << *ps++;
cout << endl;
}
Explanation / Answer
#include using namespace std; int main(){ void dispstr(char*); char str[] = "Vacation"; display(str); return 0; } void display(char* ps) { while( *ps ) coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.