Day 4: Arrays and Strings
Array
?
fixed number of elements of the same type stored sequentially in memoryinitialization, or unexpected resultsarrays are passed by referencemultidimensional arrays are merely an abstraction for programmers, as all the elements in the array are sequential in memory?
String
?
simply a character array and can be manipulated as suchchar hello[] = {'h','e','l','l','o','\0',}char hello = "hello"#include <iostream> #include <cstring> using namespace std; int main() { char fragment1[] = "I'm a s"; char fragment2[] = "tring!"; char fragment3[20]; char finalString[20] = ""; strcpy(fragment3, fragment1); strcat(finalString, fragment3); strcat(finalString, fragment2); cout << finalString; return 0; }??