no conversion from 'int' to 'struct node *'
时间: 2024-01-11 20:02:38 浏览: 32
This error occurs when you try to assign an integer value to a pointer variable of type 'struct node *'. The compiler is unable to convert an integer to a pointer type.
To resolve this error, make sure you are assigning a pointer value to the pointer variable. Check that the variable you're using is declared as a pointer type and that it points to a valid memory location. Also, check that the value you're assigning is of the correct pointer type.
Here's an example of how to properly assign a pointer value to a pointer variable:
```
struct node *ptr;
struct node n;
ptr = &n; // assigning the address of 'n' to 'ptr'
```
In this example, 'ptr' is declared as a pointer to a 'struct node' type. We create a new 'struct node' object called 'n' and assign its address to 'ptr'. This is a valid pointer assignment because both variables are of the same pointer type.
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)