您好,我正在使用 Turbo C... 我只是有一些疑问,我在一本书中找到了 TC 的代码,但我对给定的说明不满意。这是代码:
main()
{
int count = -1; /* why it was initialized as -1? */
char ch;
printf("Type in a phrase:\n");
ch = 'a'; /* why it was initialized as 'a'? */
while (ch != '\r') /* perform while ch is not equal to return */
{
ch = getche();
count++; /* increment the count */
}
printf("\nCharacter count is %d", count); /* prints the value of count */
}
提前致谢!