Can anyone help me with this code?
My desired output is:
String 1 = String1Text
*PointerStr1 = s + t + r + i + n + g + 1 + t + e + x + t
I appreciate any and all of your help! Thankyou in advance!
Here is my code:
Code:
#include <iostream>
using namespace std;
int main()
{
char string1[] = "Hello World";
char *ptr;
char ptr;
cout << "The character string that you inititalized is : " << string1 << endl;
for (int i = 0; *ptr + 1 !=('\0'); ++ i)
if ((*ptr +1) == '\0')
cout << *ptr;
else
{ cout << *ptr
<< '+';
}
cout << "The string that is output : " << *ptr << endl;
return 0;
}