Also, you don't want to get in the habit of using strlen() inside a loop like this:
Code:
for (i=0;i<strlen(str);i++)
printf("%d: %c\n", i, str[i]);
It's highly ineffecient and you won't want to develop bad habits. You're basically making the computer count the number of characters in the string every time you print one of the characters. A better approach is just to see if the current character is the end-of-string marker:
Code:
for(i = 0;str[i] != '\0';i++)
printf("%d: %c\n", i, str[i]);
...which will also help you understand walking through strings with pointers when you get there...
Code:
char *s;
for(s = str;*s != '\0';s++)
printf("%d: %c\n", s - str, *s);