100DaysofDSA

Charecter array:

int main(){
    char char_array1[] = {'a','b','c','d','\0'};
    cout<< char_array1;   //abcd

    char char_array2[] = {'x','y','z'};
    cout<<char_array2;    //xyzabcd

    char char_array3[] = "xyz"; 
    cout<<char_array3;    //xyz
}

Wile creating an charecter array always put a \0 charecter at the end other wise it will store garbage. Thats why in the end case we got xyzabcd instade of xyz.

cin.getline() method:

You cant just use cin to take a whole sentance as input as cin dont excepts spaces, so if it get any space in the input it terminates the input right there. Here comes cin.getline() comes to help. it take some arguments,

String:

}

- append a string with a string,
```cpp
int main(){
    string s1 = "hello world";
    s1.append(" its soumyadip");
    cout<<s1;                // hello world its soumyadip
}

} ```