/* * CS 161-020, Lecture 17, Winter 2020 * C-style strings * Author: Kiri Wagstaff * Date: February 14, 2020 */ #include #include /* not */ using namespace std; int main() { char name[5] = {}; /* space for 4 characters plus '\0' */ cout << name << ", length " << strlen(name) << endl; cin.getline(name, 5); /* 5 includes '\0' */ cout << name << ", length " << strlen(name) << endl; return 0; /* Print name with underscores between letters */ cout << name[0]; for (int i=1; i