使用指针到指针时出错

时间:2017-10-15 16:14:37

标签: c++ c visual-studio pointers

我正在使用Visual Studio 2013。 今天,我做了一些关于指针的研究,当我试图指向来自其他的指针时发现错误。 此行发生错误:     char * cPP =& cP; 当试图读取cP的地址并加上cPP时。 Visual Studio宣布:

fwrite(tabla, sizeof tabla[0], sizeof tabla / sizeof tabla[0], file);

你能解释一下吗?

我该如何修复此错误?

a value of type "char **" cannot be used to initialize an entity of type "char *"   

1 个答案:

答案 0 :(得分:2)

#define   stop __asm nop
int main()
{
    char a = 'A';
    char *cP = &a;
    char **cPP = &cP;
    stop
    return 0;
}

你必须有2 **来定义指向指针(* to *)

的指针