很难弄清楚为什么我会得到预期的“;”在函数 parseString 之后。
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
typedef struct Integer50
{
// a dynamically allocated array to hold a 50
// digit integer, stored in reverse order
int *digits;
} Integer50;
main() {
Integer50 * parseString(char * str)
{ //error is on this colon
return NULL;
}
}
最佳答案
这个:
main() {
Integer50 * parseString(char * str)
{ //error is on this colon
return NULL;
}
}
应替换为:
Integer50 * parseString(char * str)
{ //error is on this colon
return NULL;
}
int main() {
//If you need to call that `parseString` function call it here
}
所以,C 不支持函数内函数。 main
是一个函数,parseString
是另一个函数。这就是问题所在。
关于c - 预期冒号错误问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43100889/