#include #include #include #define MAX 10 // max char per line // many edge case problems with this code. // can you work them out int main(void) { int i; char s[MAX]; for (i = 0; (s[i] = getchar()) != '\n' && i < MAX-1; ++i) printf("s[%d] = %c\n", i, s[i]); // do nothing printf("after loop s[%d] = %d\n", i, s[i]); s[--i] = '\0'; printf("after s[--i] s[%d] = %d\n", i, s[i]); printf("the string is %s\n", s); return 0; }