“免费"的类型冲突 [英] Conflicting types for "free"
本文介绍了“免费"的类型冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我遇到了错误
免费"的类型冲突
Conflicting types for 'free'
在下面的free()
函数调用中.
int main ( )
{
char fx [] = "x^2+5*x-1";
node * fxNode = buildTree(fx, sizeof(fx)/sizeof(char));
printf(deriveFromTree(fxNode)); // Should print "2*x+5"
free(fxNode);
return 0;
}
不知道为什么.不知道这是否重要,但是最重要的是
Can't figure out why. Not sure if this matter, but what's above it is
#include <stdio.h>
char opstack [5] = {'+','-','*','^', '\0'};
unsigned short int lowerOpPrecedence ( char, char, char * );
int stringToUnsignedInt ( char *, unsigned int * );
int stringToDouble ( char * , double * );
unsigned short int stringCompare ( char * , char * );
void stringCopy ( char * , char * );
typedef struct treeNode
{
char * fx;
char * op;
struct treeNode * gx;
struct treeNode * hx;
} node;
unsigned short int getNodeState ( node * );
node * buildTree ( char *, int );
char * basicDerivative ( char * );
char * derivateFromTree ( node * );
及其下面是一堆函数实现.
and what's below it is a bunch of function implementations.
推荐答案
您需要添加#include <stdlib.h>
为free()
提供原型.
You need to add #include <stdlib.h>
to provide the prototype for free()
.
此外,推荐的main()
签名是int main (void)
.
这篇关于“免费"的类型冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文