将指针转换为int

| 我的源文件中有许多xmlChar *,我需要它们为整数形式。 如何正确地铸造这些? 当我尝试这个“ 0”时,它说
error: invalid operands to binary * (have ‘long unsigned int’ and ‘xmlChar *’)
当我尝试这个
world->representation = malloc(sizeof(int *) * (int) mapHeight);
我收到这个错误   体系结构x86_64的未定义符号:     \“ _ main \”,引用自:         从crt1.10.6.o开始     \“ _ commandfetcher \”,引用自:         ccPv5Pvd.o中的_commandFetcher   ld:找不到架构x86_64的符号 如何将xmlChar指针转换为int?例如xmlChar的值为30,我需要以int形式使用。     
已邀请:
您不能简单地将ѭ3cast转换为
int
。 (或者,您可以,但是它并没有按照您的想象做。) 使用
strtol
将字符串转换为整数:
char* number = \"30\";
int value = strtol(number, NULL, 0);
    
您不想强制转换指针-您想取消引用它。 但是在这种情况下,您可能想将字符串转换为整数?     

要回复问题请先登录注册