...which is a program that crashes, proving the point that the string type is much easier to use. In addition, strings are more secure when getting user input. Using char arrays for user input poses a security risk because a hacker can play around with memory that is out of bounds of the declared char array.And secondly i could do that with character arrays. With maybe 1 or 2 extra lines of code:
Code:#include <iostream> using namespace std; int main() { char combined[5]; char arrayA[25]="Hello "; char arrayB[25]="World!"; strcat(combined, arrayA); strcat(combined, arrayB); cout<<combined<<endl; return 0; }