我是C语言编程的新手,我试图编写一个接受两个int输入并将ascii转换为int值的函数。我不明白我收到的错误。
warning: implicit declaration of function 'getchar' is invalid in C99 [-Wimplicit-function-declaration] char current = getchar(); ^
int ascii2int (int radix, int valueOfPrefix) {
//set a char (variable) to getchar()
char current = getchar();
//Check to see if the current char is at the end of the line
if (current == '\n'){
return valueOfPrefix;
}
//recursivly recall the function
return ascii2int(radix, valueOfPrefix*12 + char2int(radix,current));
}