对布尔和整数使用&&运算符。错误! &&不能与Boolean和Integers一起使用

时间:2018-09-22 09:03:15

标签: android

void create_node(int x, int y, struct Node **temp)
{
    struct Node *r, *z;
    z = *temp;
    if (!z)
    {
        r = malloc(sizeof(struct Node)); // do not cast the result of malloc()!
        r->coeff = x;
        r->pow = y;
        r->next = 0;
        *temp = r;
    }
    else
    {
        r = z;
        while (r->next)
            r = r->next;

        r->next = malloc(sizeof(struct Node));
        r = r->next;
        r->coeff = x;
        r->pow = y;
        r->next = 0;
    }
}

1 个答案:

答案 0 :(得分:0)

您已经使用一个等号来获取两个无效的变量的相等性,应该使用两个等号来获取两个变量的相等性而不是一个等号,因此请尝试更改:-

  

if(grantResults.length>0 && grantResults[0] /*there ->*/ = PackageManager.PERMISSION_GRANTED) { 
    if(ContextCompat.checkSelfPermission(MainActivity.this,
    Manifest.permission.READ_PHONE_STATE)==PackageManager.PERMISSION_GRANTED) { 
        Toast.makeText(this,"Permission Granted",Toast.LENGTH_SHORT).show(); 
    }
}
  

if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { 
    if(ContextCompat.checkSelfPermission(MainActivity.this,
    Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) { 
        Toast.makeText(this,"Permission Granted",Toast.LENGTH_SHORT).show(); 
    }
}