[Error] invalid conversion from 'int**' to 'int'

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Dian0dian0/article/details/84451467

 错误原因:

112    14    C:\Data\Class\Analyse of Algorithms\Face.cpp    [Error] invalid conversion from 'int**' to 'int' [-fpermissive]

修改方式:


    int p[n][n] = { 0 },q[n][n] = { 0 };   //都初始化为零 
	srand((unsigned)time(NULL));
	//在堆区开辟空间存放数组(若是在栈区存放数组,随着函数结束,数组名指向的地址存放的内容也会被系统释放,而堆上的空间是由程序员自动给予分配和释放的)
//    int (*result )= malloc(n*n*sizeof(int));
//     int *result = new int[n*n];
    int **result = (int **)malloc(n*sizeof(int *));//为指针申请空间,
    for (int i = 0; i < n; i++)//n是行数
    {
        result[i] = (int *)malloc(sizeof(int) * n);//4是列数
    }	

猜你喜欢

转载自blog.csdn.net/Dian0dian0/article/details/84451467
int