/** * compare-0.c * * David J. Malan * malan@harvard.edu * * Tries (and fails) to compare two strings. * * Demonstrates strings as pointers to arrays. */ #include #include int main(void) { // get line of text printf("Say something: "); string s = GetString(); // get another line of text printf("Say something: "); string t = GetString(); // try (and fail) to compare strings if (s == t) { printf("You typed the same thing!\n"); } else { printf("You typed different things!\n"); } }