A string is a char array whose last element is a zero byte.
1) You haven't allocated memory for str. You should probably define it as str[100], or use malloc() to obtain memory of some appropriate...