写了一段代码。可以正确执行。但是在调试的时候显示 莫名跳出stdio.h,还显示list index out of
我的代码#include <ctype.h>
#include <stdio.h>
int main(void)
{
int sum = 0;
char ch;
int c[26]={1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,1,1,1,1,4,4,8,4,10};
printf("Enter a word: ");
while (1) {
ch=getchar();
if (ch=='\n')
break;
ch=toupper(ch);
sum+=c[(int)ch-'A'];
}
printf("Scrabble value: %d\n", sum);
return 0;
}
调试时候出错画面
{
return (--__F->_cnt >= 0)
? (int) (unsigned char) *__F->_ptr++
: _filbuf (__F);
}
__CRT_INLINE int __cdecl __MINGW_NOTHROW putc (int __c, FILE* __F)
{
return (--__F->_cnt >= 0)
? (int) (unsigned char) (*__F->_ptr++ = (char)__c)
: _flsbuf (__c, __F);
}
__CRT_INLINE int __cdecl __MINGW_NOTHROW getchar (void)
{
return (--stdin->_cnt >= 0)
? (int) (unsigned char) *stdin->_ptr++
: _filbuf (stdin);
}
__CRT_INLINE int __cdecl __MINGW_NOTHROW putchar(int __c)
{
return (--stdout->_cnt >= 0)
? (int) (unsigned char) (*stdout->_ptr++ = (char)__c)
: _flsbuf (__c, stdout);}
#else /* Use library functions. */
_CRTIMP int __cdecl __MINGW_NOTHROW getc (FILE*);
_CRTIMP int __cdecl __MINGW_NOTHROW putc (int, FILE
[此贴子已经被作者于2015-12-4 14:19编辑过]