求教:一个类型转换的问题
有这样一个函数
extern "C" bool GetStringProperty( FILE *fp,int index; const char* propName, const char **retvalue)
char *handlerType;handlerType=(char *)malloc(10*sizeof(char));GetStringProperty( FILE *fp, int index; const char* propName, &handlerType);
#include<stdlib.h>#include<stdio.h>extern "C" bool GetStringProperty( FILE *fp, int index, const char* propName, const char **retvalue ){ return 0;}int main(void){ FILE *a = 0; int b = 0; const char *c = 0; const char *handlerType =(char *)malloc(10*sizeof(char)); GetStringProperty( a, b, c, &handlerType ); return 0;}
[解决办法]
问题还是出在你是先声明后赋值上...你的handlerType前面没有类型名,或者你把malloc前面那个char*去掉