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;
}
}
答案 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();
}
}